HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_SDFCollision.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_SDFCollision_h__
9 #define __SIM_SDFCollision_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_SweptCollisionData.h"
13 #include <UT/UT_Vector3.h>
14 #include <UT/UT_ValArray.h>
15 #include <GA/GA_PageHandle.h>
16 #include <GA/GA_Handle.h>
17 #include <GA/GA_Range.h>
18 
19 class SIM_Object;
20 class SIM_Engine;
21 class GU_Detail;
22 
24 {
27  float voloffset;
28 };
29 
30 // The function SIMdetectAndResolveSDFCollisions can be used
31 // for one-way collision detection and collision resolution.
32 // Only the positions of a are modified to avoid collisions.
33 //
34 // Given linear trajectories of a set of points a, and a set
35 // of triangles b between times t_start and t_end,
36 // find modified positions for a such that the trajectories
37 // of a and b are collision free between t_start and t_end.
38 // "Collision free" means that the points of a don't
39 // intersect any of the triangles of b during a linear sweep
40 // from t_start to t_end.
41 // In addition, find a "projected" end velocity that
42 // makes the time-derivatives of the contact distances
43 // non-negative (as much as possible).
44 //
45 // Thickness is a diameter, not radius measure, so matches
46 // the behaviour of pscale.
47 template <typename FLOAT, typename INTEGER>
48 extern bool SIM_API
50  SIM_Engine &engine,
51  // A Topology
52  SIM_Object *obj,
53  GU_Detail *gdp_a,
54  GA_Range range_a,
55  typename GA_PageHandleV<UT_Vector3T<FLOAT>>::RWType &position_points_a_resolved_end,
56  typename GA_PageHandleV<UT_Vector3T<FLOAT>>::RWType &velocity_points_a_resolved_end,
57  bool usepscale,
58  typename GA_PageHandleScalar<FLOAT>::ROType &thickness_points_a,
59  typename GA_PageHandleScalar<FLOAT>::ROType &bounce_points_a,
60  typename GA_PageHandleScalar<FLOAT>::ROType &friction_points_a,
61  typename GA_PageHandleScalar<FLOAT>::ROType &dynamicfriction_points_a,
62  typename GA_PageHandleScalar<FLOAT>::ROType &bounceforward_points_a,
63  typename GA_PageHandleV<UT_Vector3T<FLOAT>>::RWType &position_points_a_start,
64 
65  // B Topology
66  const UT_ValArray<SIM_Object *> &affectors,
67  const UT_Array<SIM_SDFCollideInfo> &affector_info,
68  bool createimpacts,
69  bool addfeedbacks,
70  bool moveoutofsdf,
71 
72  // Timing
73  const fpreal64 t_start,
74  const fpreal64 t_end
75 );
76 
77 template <typename FLOAT, typename INTEGER>
78 extern bool SIM_API
80  SIM_Engine &engine,
81  // A Topology
82  SIM_Object *obj,
83  GU_Detail *gdp_a,
84  GA_Range range_a,
85  typename GA_PageHandleV<UT_Vector3T<FLOAT>>::RWType &position_points_a_resolved_end,
86  bool usepscale,
87  typename GA_PageHandleScalar<FLOAT>::ROType &thickness_points_a,
88  typename GA_PageHandleV<UT_Vector3T<FLOAT>>::RWType &position_points_a_start,
89 
90  // B Topology
91  const UT_ValArray<SIM_Object *> &affectors,
92  const UT_Array<SIM_SDFCollideInfo> &affector_info,
93 
94  // Timing
95  const fpreal64 t_start,
96  const fpreal64 t_end,
97 
98  // Results
99  GA_RWHandleT<INTEGER> &hitnum_a,
100  GA_RWHandleT<UT_Vector3T<FLOAT>> &hitpos_a,
101  GA_RWHandleT<UT_Vector3T<FLOAT>> &hitnml_a,
102  GA_RWHandleT<FLOAT> &hittime_a,
103  GA_RWHandleS &hitpath_a,
104  GA_RWHandleT<INTEGER> &hitprim_a,
107 );
108 
109 #endif
3D Vector class.
A range of elements in an index-map.
Definition: GA_Range.h:42
double fpreal64
Definition: SYS_Types.h:201
GLhandleARB obj
Definition: glew.h:6266
#define SIM_API
Definition: SIM_API.h:10
bool SIM_API SIMdetectAndResolveSDFCollisions(SIM_Engine &engine, SIM_Object *obj, GU_Detail *gdp_a, GA_Range range_a, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &position_points_a_resolved_end, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &velocity_points_a_resolved_end, bool usepscale, typename GA_PageHandleScalar< FLOAT >::ROType &thickness_points_a, typename GA_PageHandleScalar< FLOAT >::ROType &bounce_points_a, typename GA_PageHandleScalar< FLOAT >::ROType &friction_points_a, typename GA_PageHandleScalar< FLOAT >::ROType &dynamicfriction_points_a, typename GA_PageHandleScalar< FLOAT >::ROType &bounceforward_points_a, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &position_points_a_start, const UT_ValArray< SIM_Object * > &affectors, const UT_Array< SIM_SDFCollideInfo > &affector_info, bool createimpacts, bool addfeedbacks, bool moveoutofsdf, const fpreal64 t_start, const fpreal64 t_end)
bool SIM_API SIMdetectSDFCollisions(SIM_Engine &engine, SIM_Object *obj, GU_Detail *gdp_a, GA_Range range_a, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &position_points_a_resolved_end, bool usepscale, typename GA_PageHandleScalar< FLOAT >::ROType &thickness_points_a, typename GA_PageHandleV< UT_Vector3T< FLOAT >>::RWType &position_points_a_start, const UT_ValArray< SIM_Object * > &affectors, const UT_Array< SIM_SDFCollideInfo > &affector_info, const fpreal64 t_start, const fpreal64 t_end, GA_RWHandleT< INTEGER > &hitnum_a, GA_RWHandleT< UT_Vector3T< FLOAT >> &hitpos_a, GA_RWHandleT< UT_Vector3T< FLOAT >> &hitnml_a, GA_RWHandleT< FLOAT > &hittime_a, GA_RWHandleS &hitpath_a, GA_RWHandleT< INTEGER > &hitprim_a, GA_RWHandleT< UT_Vector3T< FLOAT >> &hituv_a, GA_RWHandleT< UT_Vector3T< FLOAT >> &hitvel_a)