8 #ifndef __SIM_SweptCollisionUtility_h__
9 #define __SIM_SweptCollisionUtility_h__
35 return (0 <= i) && (i <
n);
68 return myIdentities.size();
74 UT_ASSERT( (0 <= p) && (p < myIdentities.size()) );
77 index_object =
id.myIndexObject;
86 return myRanges.size();
94 UT_ASSERT( !
"not a valid object index!" );
98 const std::pair< int, int >& object_range(myRanges[index_object]);
100 const int num_points_range(object_range.second - object_range.first);
104 return num_points_range;
109 std::vector<SIM_MergedIdentityPoint> myIdentities;
112 std::vector< std::pair< int, int > > myRanges;
136 const int index_object
138 myIdentities(merged_points.myIdentities),
139 myBegin(merged_points.myRanges[index_object].
first),
140 myEnd(merged_points.myRanges[index_object].second)
148 inline int getP(
const int pid)
const
150 UT_ASSERT( (0 <= pid) && (pid < myEnd - myBegin) );
152 return myBegin + pid;
157 return myEnd - myBegin;
162 return myEnd - myBegin;
166 const std::vector<SIM_MergedIdentityPoint>& myIdentities;
195 return myOriginalPrims(i);
261 std::vector<fpreal32>& thickness_points,
264 const fpreal default_thickness
271 const fpreal default_bounce
278 const fpreal default_friction
285 const fpreal default_bounceforward
330 std::vector<SIM_UnpackedGeometry> &unpacked_geometries_end,
331 std::vector<int>& id_objects,
332 std::vector<fpreal32> *thickness_points,
333 std::vector<fpreal32> *bounce_points,
334 std::vector<fpreal32> *friction_points,
335 std::vector<fpreal32> *bounceforward_points,
340 const std::vector<const SIM_Object*>& objects,
341 const fpreal default_thickness,
351 std::vector<fpreal32> *thickness_points,
359 const fpreal default_thickness,
369 template <
typename FLOAT>
384 fpreal default_thickness);
391 const std::vector<SIM_UnpackedGeometry>& unpacked_geometries,
392 const std::vector<const SIM_Object*>& objects
408 const std::vector<UT_DMatrix4>& transforms,
419 const std::vector<UT_DMatrix4>& transforms,
432 const std::vector<SIM_GeometryCopy*>& geometries,
436 const std::vector<UT_DMatrix4>& transforms
447 const std::vector<const SIM_Geometry*>& geometries_end
456 std::vector<SIM_GeometryCopy*>& geometries_end,
466 template <
typename FLOAT>
476 template <
typename FLOAT>
503 const int impact_flags,
504 const bool pscaleisradius
fpreal SIM_API SIMreadBounceForwardParameterObject(const SIM_Object &object, const fpreal default_bounceforward)
int getNumPointsObject(const int index_object) const
void SIM_API SIMextractTriangleConnectivityMerged(SIM_TriangleConnectivity &triangles, const SIM_MergeMapObject &merged_points, const SIM_UnpackedGeometry &unpacked_geometry, const char *geopath)
Extract the triangle connectivity for a single object.
int getNumPointsMerged() const
void getObjectAndPid(int &index_object, int &pid, const int p) const
bool SIMisValidIndex(const int i, const int n)
void SIM_API SIMreadPositionPoints(SIM_PositionPoints &position_points, const SIM_MergeMap &merged_points, const std::vector< UT_DMatrix4 > &transforms, const UT_Array< const GU_Detail * > &gdps)
void SIM_API SIMreadSweptState(SIM_MergeMap &merged_points, std::vector< SIM_UnpackedGeometry > &unpacked_geometries_end, std::vector< int > &id_objects, std::vector< fpreal32 > *thickness_points, std::vector< fpreal32 > *bounce_points, std::vector< fpreal32 > *friction_points, std::vector< fpreal32 > *bounceforward_points, SIM_PositionPoints &position_points_start, SIM_PositionPoints &position_points_end, SIM_VelocityPoints *velocity_points_end, const SIM_Engine &engine, const std::vector< const SIM_Object * > &objects, const fpreal default_thickness, const fpreal64 t_start, const fpreal64 t_end)
fpreal SIM_API SIMreadBounceParameterObject(const SIM_Object &object, const fpreal default_bounce)
void SIM_API SIMreadPreviousPositionAttribute(SIM_PositionPoints &position_points, const SIM_MergeMap &merge_map, const std::vector< const SIM_Geometry * > &geometries_end)
A range of elements in an index-map.
void SIM_API SIMwritePreviousPositionAttribute(std::vector< SIM_GeometryCopy * > &geometries_end, const SIM_MergeMap &merge_map, const SIM_PositionPoints &position_points)
void SIM_API SIMreadThicknessPoints(std::vector< fpreal32 > &thickness_points, const SIM_MergeMap &merged_points, const UT_Array< const GU_Detail * > &gdps_end, const fpreal default_thickness)
int getNumPointsObject() const
bool SIM_API SIMgetGeometryAndTransformAtTime(const SIM_Geometry *&geometry, UT_DMatrix4 &geometry_to_sim, const SIM_Engine &engine, const SIM_Object &undated_object, const SIM_Time &t)
SIM_MergedIdentityPoint()
void SIM_API SIMwritePositionAndVelocityPoints(const std::vector< SIM_GeometryCopy * > &geometries, const SIM_MergeMap &merged_points, const SIM_PositionPoints &position_points, const SIM_VelocityPoints &velocity_points, const std::vector< UT_DMatrix4 > &transforms)
int getNumObjects() const
GU_ConstDetailHandle getGeometry() const
Returns the unpacked geometry.
SIM_MergeMapObject(const SIM_MergeMap &merged_points, const int index_object)
void SIM_API SIMmergePoints(SIM_MergeMap &merged_points, const UT_Array< const GU_Detail * > &gdps)
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
void SIM_API SIMcopyAttribute(GU_Detail *gdp, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &prevppos_ph, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &pos_ph)
int getP(const int pid) const
bool SIM_API SIMdetectCollisionsAndGenerateImpulses(SIM_Impacts *impacts_a, SIM_Impacts *impacts_b, const SIM_Engine &engine, SIM_Object *const undated_object_a, const SIM_Object *const undated_object_b, const SIM_Time &t_start, const SIM_Time &t_end, const int impact_flags, const bool pscaleisradius)
void SIM_API SIMcreatePreviousPositionAttribute(GU_Detail *gdp, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &prevppos_ph, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &pos_ph)
LeafData & operator=(const LeafData &)=delete
std::vector< SIM_PositionPoint > SIM_PositionPoints
void SIM_API SIMreadVelocityPointsFromAttribute(SIM_VelocityPoints &velocity_points, const SIM_MergeMap &merged_points, const std::vector< UT_DMatrix4 > &transforms, const UT_Array< const GU_Detail * > &gdps)
bool SIM_API SIMgetGeometryAndTransform(const SIM_Geometry *&geometry, UT_DMatrix4 &geometry_to_sim, const SIM_Object &object)
std::vector< SIM_VelocityPoint > SIM_VelocityPoints
GA_Index getOriginalPrimIndex(GA_Index i) const
int getNumPointsMerged() const
fpreal SIM_API SIMreadFrictionParameterObject(const SIM_Object &object, const fpreal default_friction)
This implements a SIM_Geometry that copies the source geometry.