HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 extern bool SIM_API
49  SIM_Engine &engine,
50  // A Topology
51  SIM_Object *obj,
52  GU_Detail *gdp_a,
53  GA_Range range_a,
54  GA_RWPageHandleV3 &position_points_a_resolved_end,
55  GA_RWPageHandleV3 &velocity_points_a_resolved_end,
56  bool usepscale,
57  GA_ROPageHandleF &thickness_points_a,
58  GA_ROPageHandleF &bounce_points_a,
59  GA_ROPageHandleF &friction_points_a,
60  GA_ROPageHandleF &dynamicfriction_points_a,
61  GA_ROPageHandleF &bounceforward_points_a,
62  GA_RWPageHandleV3 &position_points_a_start,
63 
64  // B Topology
65  const UT_ValArray<SIM_Object *> &affectors,
66  const UT_Array<SIM_SDFCollideInfo> &affector_info,
67  bool createimpacts,
68  bool addfeedbacks,
69  bool moveoutofsdf,
70 
71  // Timing
72  const fpreal64 t_start,
73  const fpreal64 t_end
74 );
75 
76 extern bool SIM_API
78  SIM_Engine &engine,
79  // A Topology
80  SIM_Object *obj,
81  GU_Detail *gdp_a,
82  GA_Range range_a,
83  GA_RWPageHandleV3 &position_points_a_resolved_end,
84  bool usepscale,
85  GA_ROPageHandleF &thickness_points_a,
86  GA_RWPageHandleV3 &position_points_a_start,
87 
88  // B Topology
89  const UT_ValArray<SIM_Object *> &affectors,
90  const UT_Array<SIM_SDFCollideInfo> &affector_info,
91 
92  // Timing
93  const fpreal64 t_start,
94  const fpreal64 t_end,
95 
96  // Results
97  GA_RWHandleI &hitnum_a,
98  GA_RWHandleV3 &hitpos_a,
99  GA_RWHandleV3 &hitnml_a,
100  GA_RWHandleF &hittime_a,
101  GA_RWHandleS &hitpath_a,
102  GA_RWHandleI &hitprim_a,
103  GA_RWHandleV3 &hituv_a,
104  GA_RWHandleV3 &hitvel_a
105 );
106 
107 #endif
bool SIM_API SIMdetectAndResolveSDFCollisions(SIM_Engine &engine, SIM_Object *obj, GU_Detail *gdp_a, GA_Range range_a, GA_RWPageHandleV3 &position_points_a_resolved_end, GA_RWPageHandleV3 &velocity_points_a_resolved_end, bool usepscale, GA_ROPageHandleF &thickness_points_a, GA_ROPageHandleF &bounce_points_a, GA_ROPageHandleF &friction_points_a, GA_ROPageHandleF &dynamicfriction_points_a, GA_ROPageHandleF &bounceforward_points_a, GA_RWPageHandleV3 &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)
Read-Write string handle.
Definition: GA_Handle.h:942
A range of elements in an index-map.
Definition: GA_Range.h:42
double fpreal64
Definition: SYS_Types.h:185
#define SIM_API
Definition: SIM_API.h:10
bool SIM_API SIMdetectSDFCollisions(SIM_Engine &engine, SIM_Object *obj, GU_Detail *gdp_a, GA_Range range_a, GA_RWPageHandleV3 &position_points_a_resolved_end, bool usepscale, GA_ROPageHandleF &thickness_points_a, GA_RWPageHandleV3 &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_RWHandleI &hitnum_a, GA_RWHandleV3 &hitpos_a, GA_RWHandleV3 &hitnml_a, GA_RWHandleF &hittime_a, GA_RWHandleS &hitpath_a, GA_RWHandleI &hitprim_a, GA_RWHandleV3 &hituv_a, GA_RWHandleV3 &hitvel_a)