LiPrimitiveConsistentParts

FunctionLtPref
LiPrimitiveConsistentParts( LtPrim prim
)
Synopsis Make the orientation of all polygons in a mesh consistent.
Locationligeops
Parameters
prim The primitive which is to be made consistent.
Return Value A list of consistent primitives..

Description LiPrimitiveConsistentParts accepts only polygon mesh primitives as input. It picks a single polygon from the mesh, and ensures that all other polygons in the mesh have a winding which is consistent with the chosen polygon. If some polygons cannot be joined to the chosen polygon by edge/edge boundaries then these polygons will be removed from the input primitive and bundled into a new mesh. This new mesh will itself be passed to LiPrimitiveConsistentParts and the result appended to the (now consistent) input primitive using a primitive reference. The resulting list of consistent primitives comprises the function's return value.

Example
LtPoint      positions[6] ;
LtProp       props[1] ;
LtData       values[1] ;
LtPrim       mesh ;
LtNat32      nloops[] = { (LtNat32)1, (LtNat32)1 } ,
             nverts[] = { (LtNat32)4, (LtNat32)4 } ,
             indices[] = { (LtNat32)0, (LtNat32)1,
                           (LtNat32)2, (LtNat32)3, 
                           (LtNat32)4, (LtNat32)5 } ;
LtPref       output ;

LiPointInitialise( positions[ 0 ],
                  -1.0,  1.0,  0.0 ) ;
LiPointInitialise( positions[ 1 ],
                  -1.0,  0.0,  0.0 ) ;
LiPointInitialise( positions[ 2 ],
                   0.0,  0.0,  0.0 ) ;
LiPointInitialise( positions[ 3 ],
                   0.0,  1.0,  0.0 ) ;
LiPointInitialise( positions[ 4 ],
                   1.0,  1.0,  0.0 ) ;
LiPointInitialise( positions[ 5 ],
                   1.0,  0.0,  0.0 ) ;

props[ 0 ] = LI_PROP_VERT_WORLD ;
LiDataSetFloatPtr( values, positions ) ;

/*
 * Deliberately create a mesh with two 
 * inconsistent polygons.
 */

mesh = LiPrimitiveCreateMesh( (LtNat32)2,
                              nloops, nverts, indices, 
                              (LtNat32)1,
                              props, values ) ;

output = LiPrimitiveConsistentParts( mesh );

See Also LiPrimitiveConsistentPolygon
LiPrimitiveReferenceConsistentParts
LiPrimitiveReverse
LiPrimitiveReferenceReverse


© LightWork Design Ltd. All information contained in this document is the copyright of LightWork Design Ltd. (unless stated otherwise) and may not be used or reproduced with prior written consent.