7 #ifndef __SIM_ConstraintNetworkIterator_h__
8 #define __SIM_ConstraintNetworkIterator_h__
33 namespace SIM_ConstraintNetwork
114 virtual void init(
const GU_Detail *gdp,
exint num_constraint_types) = 0;
119 virtual bool acceptConstraint(
const SIM_Data &constraint_data,
165 bool skip_broken =
true);
176 bool skip_broken =
true);
196 bool isBroken()
const;
199 exint getConstraintDataIndex()
const;
205 GA_Offset getPointOffset(
bool anchor1)
const;
208 GA_Index getPointNumber(
bool anchor1)
const;
213 return myConstraintIdAttrib.isValid() ?
214 myConstraintIdAttrib.get(myPrimOffset) :
227 void buildConstraintTypeCache();
235 exint myConstraintDataIndex;
243 exint myConstraintIndex;
248 bool mySkipBroken =
true;
277 bool skip_broken =
true);
282 void rewind() {
return myImpl.rewind(); }
283 bool atEnd()
const {
return myImpl.atEnd(); }
292 bool isBroken()
const {
return myImpl.isBroken(); }
298 GA_Index getPointNumber(
bool anchor1)
const;
308 void breakConstraint();
335 bool myHasBrokenConstraints;
350 void init(
const GU_Detail *gdp,
exint num_constraint_types)
override;
351 bool acceptConstraint(
const SIM_Data &constraint_data,
357 const SIM_Data *getConstraintData()
const;
362 template <
typename T>
366 template <
typename T>
371 template <
typename T>
372 bool getPrimitiveAttribute(
380 template <
typename T>
381 bool getPrimitiveAttribute(
387 template <
typename T>
398 static void getOption(
404 static void getOption(
411 static void getOption(
419 static void getOption(
427 static void getOption(
440 exint myConstraintDataIndex;
476 GA_Offset getAnchorPointOffset(
bool anchor1)
const;
480 GA_Index getAnchorPointIndex(
bool anchor1)
const;
482 UT_Vector3 getAnchorPosition(
bool anchor1)
const;
483 UT_Vector3 getAnchorVelocity(
bool anchor1)
const;
489 UT_Vector3 getAnchorAngularVelocity(
bool anchor1)
const;
491 bool getObjectCentroid(
bool anchor1,
UT_Vector3 &pos)
const;
493 int getAnchorNumConDOFs(
bool anchor1)
const;
494 UT_Vector3 getAnchorDOFVector(
bool anchor1)
const;
500 int getObjectId(
bool anchor1)
const;
501 const SIM_Object *getObject(
bool anchor1)
const;
504 class CachedObjectData
508 bool need_object_geo,
509 bool need_object_centroid,
511 ~CachedObjectData() {}
517 const GU_Detail *gdp = myGeoReadLock->getGdp();
550 getAnchorPointOffset(
bool anchor1,
const CachedObjectData *
data)
const;
553 const CachedObjectData *getCachedData(
bool anchor1)
const;
557 int getAnchorId(
bool anchor1)
const;
562 UT_Quaternion getInitialAnchorOrientation(
bool anchor1)
const;
568 return anchor1 ? myPtBOffset : myPtAOffset;
583 bool myNeedObjectCentroid;
SIM_API const UT_StringHolder vertex
SIM_API const UT_StringHolder anchor_type
void advance(GA_Offset pt_a, GA_Offset pt_b)
PositionType
How the position of the anchor is interpreted.
GA_Index getPrimIndex() const
Return the primitive number corresponding to the current constraint.
const UT_Vector2D & getOptionV2(const UT_StringRef &name) const
const_iterator & getConstIterator()
Returns the underlying const_iterator.
Iteration over a range of elements.
SIM_API const UT_StringHolder angle
UT_Vector2T< fpreal64 > UT_Vector2D
SIM_API const UT_StringHolder agent
GLsizei const GLfloat * value
SIM_API const UT_StringHolder torque
GU_Detail & getGdp() const
exint getConstraintIndex() const
The number of valid constraints that have been seen so far.
SIM_API const UT_StringHolder local_P
int64 getOptionI(const UT_StringRef &name) const
SIM_API const UT_StringHolder next_constraint_type
const UT_Vector3D & getOptionV3(const UT_StringRef &name) const
SIM_API const UT_StringHolder local_orient
SIM_API bool buildConstraintDataCache(const GU_Detail &gdp, const GA_ROHandleS &constraint_name_attrib, const SIM_Data &root_data, ConstraintAccessor &constraint_accessor, UT_BitArray &valid_constraint_data)
SIM_API const UT_StringHolder all
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
exint getConstraintId() const
Unique id of the current constraint, if the id attribute exists.
SIM_API void addTorqueAttributes(GU_Detail &gdp, GA_RWHandleF &torque, GA_RWHandleF &angle)
Creates the 'torque' and 'angle' primitive attributes.
exint getConstraintDataIndex() const
Returns the index of the current constraint data type.
SIM_API void addForceAttributes(GU_Detail &gdp, GA_RWHandleF &force, GA_RWHandleF &distance)
Creates the 'force' and 'distance' primitive attributes.
UT_QuaternionT< fpreal64 > UT_QuaternionD
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
SIM_API const UT_StringHolder next_constraint_name
SIM_API const UT_StringHolder broken
SIM_API const UT_StringHolder rotation
UT_Vector3T< fpreal64 > UT_Vector3D
const UT_QuaternionD & getOptionQ(const UT_StringRef &name) const
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
const GU_Detail & getGdp() const
The constraint network geometry.
const SIM_Options & getOptions() const
SIM_API GA_ROHandleS getConstraintNameAttrib(const GU_Detail &gdp)
Returns the 'constraint_name' primitive attribute.
ConstraintType
The type of a constraint (linear, angular, or both).
exint getConstraintIndex() const
Return the number of constraints that have been seen so far.
SIM_API const UT_StringHolder force
SIM_API const UT_StringHolder anchor_vid
SIM_API const UT_StringHolder position
SIM_API const UT_StringHolder constraint_type
GA_BlobIndex GA_StringIndexType
GA_Offset getPrimOffset() const
The primitive offset.
SIM_API const UT_StringHolder distance
SIM_API const UT_StringHolder anchor_pid
SIM_API const UT_StringHolder constraint_name
fpreal64 getOptionF(const UT_StringRef &name) const
SIM_API const UT_StringHolder anchor_id
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GA_Offset getPrimOffset() const
This implements a SIM_Geometry that copies the source geometry.