HDK

#include <GU_Insetter.h>
Public Types  
enum  OffsetConversion { IDENTITY = 0, VERTEX_TO_POINT, VERTEX_TO_PRIMITIVE } 
Public Member Functions  
GU_Insetter (const GU_Detail *gdp, int num_chains, int *chian_lengths, GA_Offset *joint_offsets, bool *closed_flags, const UT_Vector3 *edge_vel, GA_ROHandleV3 pos, const UT_Vector3 *joint_vel=nullptr, bool two_sided=true, OffsetConversion off_conv=IDENTITY, fpreal coplanar_tol=INSET_COPLANARITY_TOL, bool merge_branches=true, bool common_limit=false)  
~GU_Insetter ()  
UT_Vector3  getSrcInsetVector (int idx, fpreal inset, int *is_limit=nullptr) 
UT_Vector3  getDstInsetVector (int idx, fpreal inset, int *is_limit=nullptr) 
fpreal  getLimit (bool positive=true) 
Static Public Member Functions  
static UT_Vector3  edgeVelocity (UT_Vector3 edge_vect, UT_Vector3 prim_nml) 
Helper methods for setting up an insetter: More...  
static UT_Vector3  jointVelocity (UT_Vector3 v0, UT_Vector3 v1, UT_Vector3 b0, UT_Vector3 b1, fpreal min_coplanar_nml_diff_cos=INSET_COPLANARITY_TOL, bool *is_folded_joint=nullptr) 
static bool  isFoldedJoint (UT_Vector3 v0, UT_Vector3 v1, UT_Vector3 b0, UT_Vector3 b1, fpreal min_coplanar_nml_diff_cos, UT_Vector3 *n0=nullptr, UT_Vector3 *n1=nullptr) 
Definition at line 87 of file GU_Insetter.h.
OffsetConversion tells the insetter to optionally convert a joint given using a vertex offset into its wired primitive or point offset before evaluating the position attribute handle on it.
Enumerator  

IDENTITY  
VERTEX_TO_POINT  
VERTEX_TO_PRIMITIVE 
Definition at line 95 of file GU_Insetter.h.
GU_Insetter::GU_Insetter  (  const GU_Detail *  gdp, 
int  num_chains,  
int *  chian_lengths,  
GA_Offset *  joint_offsets,  
bool *  closed_flags,  
const UT_Vector3 *  edge_vel,  
GA_ROHandleV3  pos,  
const UT_Vector3 *  joint_vel = nullptr , 

bool  two_sided = true , 

OffsetConversion  off_conv = IDENTITY , 

fpreal  coplanar_tol = INSET_COPLANARITY_TOL , 

bool  merge_branches = true , 

bool  common_limit = false 

) 
GU_Insetter works on one or more sequences of (point/primitive/vertex) offsets on a detail. Each sequence of offsets, along with a position attribute defines a chain of edges. The endpoints of the edges, which we call the joints of the chain, can be repeated along the chain (an offset may appear multiple times in the same chain). Each edge of the chain is supplied with a velocity vector along which it will be slid. It is also possible to override the otherwise calculated joint velocities.
The number of chains is specified by 'num_chains'. The 'chain_lengths' array should have at least num_chains elements and specifies the number of joints in each chain. The 'joint_offsets' array must present the joint offsets for all chains back to back and therefore should have length (at least) equal to the sum of the elements in 'chain_lengths'.
Each chain can be "closed" or "open", respectively meaning an edge is or is not interpreted to exist between the last joint of the chain and its first. Setting 'closed_flags' to NULL indicates that all the chains are "closed". Otherwise the array to which it points must have least num_chains elements.
The 'edge_vel' array must always be supplied with exactly the same length as joint_offsets to indicate the velocity vector for the edge between the joint at a corresponding position and its successor. The velocity vector paired with the last joint of an open chain is ignored.
The 'joint_vel' array, provides overrides for the joint velocities that are automatically calculated based on edge velocities. Joints with override velocity set to (0, 0, 0) still get a calculated velocity. However, joints with preset velocities are ensured to always move in the given direction even after merging with other trajectories. If two joints with preset velocities collide, the insetting limit is reached.
Two sided insetters can evaluate both positive and negative inset amounts. If 'twosided' is set to false, evaluation of inset position for negative isnet amounts will only use the initial joint velocity vectors.
'collinearity_tol' is the cosine of the largest angle between the normals of the planes scanned by two edge velocity vectors below which the planes are considered parallel.
GU_Insetter::~GU_Insetter  (  ) 

inlinestatic 
Helper methods for setting up an insetter:
Return the velocity vector for sliding an edge of a polygon with direction edge_vect, inward on the polygon parallel to itself. prim_nml must be a unit vector but edge_vect need not be.
Definition at line 653 of file GU_Insetter.h.
UT_Vector3 GU_Insetter::getDstInsetVector  (  int  idx, 
fpreal  inset,  
int *  is_limit = nullptr 

) 
fpreal GU_Insetter::getLimit  (  bool  positive = true  ) 
Returns the inset value beyond which insetting freezes, ie, the outcome stays the same for larger values. If no limit exists, 1 is returned. If the insetter is twosided, the returned limit is the the limit of the positive side if 'positive' is set true or that of the negative side otherwise. If singlesided, the parameter is ignored. Note that the limit of the negative side is returned as a positive number if such a limit exists (and as 1 otherwise) and the actual limit value would be the negative of the returned amount.
UT_Vector3 GU_Insetter::getSrcInsetVector  (  int  idx, 
fpreal  inset,  
int *  is_limit = nullptr 

) 

inlinestatic 
Test used to determine if a joint defined by velocity vectors b0 and b1 should be treated as a fold. In contrast to a flat joint where the joint moves along the bisector of the joint edges during insetting, a folded joint moves along the line of intersection of the two planes defined by the two velocity vectors. If n0 or n1 are nonNULL, the respective plane normals of the joint are returned.
Definition at line 565 of file GU_Insetter.h.

inlinestatic 
Vectors v0 and v1 are oriented consecutive edge vectors whose common endpoint's insetting direction is determined by this method. b0 and b1 are the directions along which the edges are shifted during insetting.
If b0 is 0, then the inset direction will be along v0 and if b1 is 0, then the inset direction will be along v1.
min_coplanar_nml_diff_cos is cosine of the smallest angle between normals of the planes respectively defined by v0, b0 and v1, b1, beyond which the two planes are taken as distinct and the line shared between them treated as a fold, causing the inset vector to move along this fold line. The velocity of the movement is then determined by the edge that makes a smaller angle with the fold.
Definition at line 586 of file GU_Insetter.h.