ImageDev

PolylineExtrusion3d

Extrudes a three-dimensional polyline in a given direction to produce a quadrilateral mesh surface.

Access to parameter description

This algorithm replicates the input polyline in a predefined direction and in its opposite direction with a regular spacing. A quadrilateral mesh is thus generated, considering each polyline vertex as a mesh vertex.

<b> (a) </b>
(a)
<b> (b) </b>
(b)
Figure 1. Polyline extrusion: (a) input polyline regularized by PolylineResampler3d, (b) extruded quadrilateral mesh in blue
See also

Function Syntax

This function returns the outputSurface output parameter.
// Function prototype.
std::shared_ptr<iolink::ArrayXd>
polylineExtrusion3d( std::shared_ptr<iolink::ArrayXd> inputPolyline,
                     double forwardLength,
                     double backwardLength,
                     uint32_t nodeCount,
                     iolink::Vector3d direction,
                     std::shared_ptr<iolink::ArrayXd> outputSurface = NULL );
This function returns the outputSurface output parameter.
// Function prototype.
polyline_extrusion_3d( input_polyline,
                       forward_length = 1,
                       backward_length = 1,
                       node_count = 20,
                       direction = [0, 0, 1],
                       output_surface = None )
This function returns the outputSurface output parameter.
// Function prototype.
public static IOLink.ArrayXd
PolylineExtrusion3d( IOLink.ArrayXd inputPolyline,
                     double forwardLength = 1,
                     double backwardLength = 1,
                     UInt32 nodeCount = 20,
                     double[] direction = null,
                     IOLink.ArrayXd outputSurface = null );

Class Syntax

Parameters

Class Name PolylineExtrusion3d

Parameter Name Description Type Supported Values Default Value
input
inputPolyline
The input ArrayXd to extrude.
The indexation needs to be {coordinate, index}, where coordinate is the axis index (0 for X, 1 for Y and 2 for Z) and index is a label identifying the vertex.
ArrayXd nullptr
input
forwardLength
The extrusion length from the input polyline in the extrusion direction.
This length is expressed in world coordinates.
Float64 >=0 1
input
backwardLength
The extrusion length from the input polyline opposite to the extrusion direction.
This length is expressed in world coordinates.
Float64 >=0 1
input
nodeCount
Number of nodes to create along the whole extruded section along the sum of forward and backward lengths. UInt32 Any value 20
input
direction
The extrusion direction.
This direction is expressed in the coordinate system of the input polyline.
Vector3d Any value {0.f, 0.f, 1.f}
output
outputSurface
The output surface.
The dimensions of the generated ArrayXd is [3, n, m] with:
  • 3, the number of coordinates of a 3D point respectively corresponding to X, Y, and Z, expressed in world coordinates.
  • n, the number of columns of the mesh.
  • m, the number of rows of the mesh.
ArrayXd nullptr

Object Examples

std::shared_ptr< iolink::ArrayXd> polyline3d_1( new iolink::ArrayXd( { 0 } ) );
readArrayXd( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "polyline3d_1.arrayxd", polyline3d_1);

PolylineExtrusion3d polylineExtrusion3dAlgo;
polylineExtrusion3dAlgo.setInputPolyline( polyline3d_1 );
polylineExtrusion3dAlgo.setForwardLength( 1 );
polylineExtrusion3dAlgo.setBackwardLength( 1 );
polylineExtrusion3dAlgo.setNodeCount( 20 );
polylineExtrusion3dAlgo.setDirection( {0, 0, 1} );
polylineExtrusion3dAlgo.execute();

std::cout << "outputSurface:" << polylineExtrusion3dAlgo.outputSurface()->shape();
polyline_3d_1 = np.zeros(0, dtype=np.double)
polyline_3d_1 = imagedev.read_array_xd(imagedev_data.get_object_path("polyline3d_1.arrayxd"), polyline_3d_1)

polyline_extrusion_3d_algo = imagedev.PolylineExtrusion3d()
polyline_extrusion_3d_algo.input_polyline = polyline_3d_1
polyline_extrusion_3d_algo.forward_length = 1
polyline_extrusion_3d_algo.backward_length = 1
polyline_extrusion_3d_algo.node_count = 20
polyline_extrusion_3d_algo.direction = [0, 0, 1]
polyline_extrusion_3d_algo.execute()

print( "output_surface:", str( polyline_extrusion_3d_algo.output_surface ) );
IOLink.ArrayXd polyline3d_1 = new IOLink.ArrayXd(new IOLink.VectorXu64( 0 ) ) ;
polyline3d_1 = Data.ReadArrayXd( @"Data/objects/polyline3d_1.arrayxd", polyline3d_1 );

PolylineExtrusion3d polylineExtrusion3dAlgo = new PolylineExtrusion3d
{
    inputPolyline = polyline3d_1,
    forwardLength = 1,
    backwardLength = 1,
    nodeCount = 20,
    direction = new double[]{0, 0, 1}
};
polylineExtrusion3dAlgo.Execute();

Console.WriteLine( "outputSurface:" + polylineExtrusion3dAlgo.outputSurface.ToString() );

Function Examples

std::shared_ptr< iolink::ArrayXd> polyline3d_1( new iolink::ArrayXd( { 0 } ) );
readArrayXd( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "polyline3d_1.arrayxd", polyline3d_1);

auto result = polylineExtrusion3d( polyline3d_1, 1, 1, 20, {0, 0, 1} );

std::cout << "outputSurface:" << result->shape();
polyline_3d_1 = np.zeros(0, dtype=np.double)
polyline_3d_1 = imagedev.read_array_xd(imagedev_data.get_object_path("polyline3d_1.arrayxd"), polyline_3d_1)

result = imagedev.polyline_extrusion_3d( polyline_3d_1, 1, 1, 20, [0, 0, 1] )

print( "output_surface:", str( result ) );
IOLink.ArrayXd polyline3d_1 = new IOLink.ArrayXd(new IOLink.VectorXu64( 0 ) ) ;
polyline3d_1 = Data.ReadArrayXd( @"Data/objects/polyline3d_1.arrayxd", polyline3d_1 );

IOLink.ArrayXd result = Processing.PolylineExtrusion3d( polyline3d_1, 1, 1, 20, new double[]{0, 0, 1} );

Console.WriteLine( "outputSurface:" + result.ToString() );