PeriDyno 1.0.0
Loading...
Searching...
No Matches
VehicleInfo.h
Go to the documentation of this file.
1
2#pragma once
3#include <vector>
4#include <memory>
5#include <string>
6
7#include "Vector.h"
8#include "Matrix.h"
9#include "OBase.h"
10
11
12namespace dyno {
13
20
22 {
23 Box = 1,
24 Tet = 2,
26 Sphere = 8,
27 Tri = 16,
28 OtherShape = 0x80000000
29 };
30
32 {
34 Slider = 2,
35 Hinge = 3,
36 Fixed = 4,
37 Point = 5,
38 OtherJoint = 0x80000000
39 };
40
41 struct Name_Shape
42 {
43 //Func
45 Name_Shape(std::string n,int Id = -1)
46 {
47 name = n;
48 rigidBodyId = Id;
49 }
50
51 //Var
52 std::string name = "";
53 int rigidBodyId = -1;
54
55 };
56
61 {
63
64 VehicleRigidBodyInfo(Name_Shape name, int shapeId, ConfigShapeType type,Real density = 100) //
65 {
66 shapeName = name;
67 meshShapeId = shapeId;
68 shapeType = type;
69 mDensity = density;
70 };
71
72 VehicleRigidBodyInfo(Name_Shape name, int shapeId, ConfigShapeType type, Transform3f trans, Real density = 100) //
73 {
74 shapeName = name;
75 meshShapeId = shapeId;
76 shapeType = type;
77 transform = trans;
78 mDensity = density;
79 };
80
81 //Shape:
83
84 int meshShapeId = -1;
86 Transform3f transform = Transform3f(Vec3f(0), Mat3f::identityMatrix(), Vec3f(1));
88
89 Vec3f mHalfLength = Vec3f(1); // if(type == Box);
90 float radius = 1; // if(type == Sphere); if(type == Capsule);
91 std::vector<Vec3f> tet = {Vec3f(0),Vec3f(0),Vec3f(0),Vec3f(0,1,0) }; // if(type == Tet);
92 float capsuleLength = 1; // if(type == Capsule);
94
96
98 };
99
104 {
107 Name_Shape Name1,
108 Name_Shape Name2,
109 ConfigJointType typeIn,
110 Vector<Real, 3> Axi = Vec3f(1, 0, 0),
112 bool Moter = false,
113 Real moter = 0,
114 bool Range = false,
115 Real min = 0,
116 Real max = 0
117 )
118 {
119 mRigidBodyName_1 = Name1;
120 mRigidBodyName_2 = Name2;
121 mUseMoter = Moter;
122 mUseRange = Range;
124 mMin = min;
125 mMax = max;
126 mMoter = moter;
127 mAxis = Axi;
128 mJointType = typeIn;
129 }
130
134 bool mUseMoter = false;
135 bool mUseRange = false;
141 };
142
143
150 {
151 public:
153 VehicleBind(int size)
154 {
155 mVehicleRigidBodyInfo.resize(size);
156 for (int i = 0; i < mVehicleRigidBodyInfo.size(); i++)
157 {
158 mVehicleRigidBodyInfo[i].shapeName = Name_Shape(std::string("Rigid") + std::to_string(i),i);
159 mVehicleRigidBodyInfo[i].meshShapeId = i;
160 }
161 mVehicleJointInfo.resize(size);
162 }
164 {
165 mVehicleRigidBodyInfo.clear();
166 mVehicleJointInfo.clear();
167 }
168
169 bool isValid()
170 {
171 return mVehicleRigidBodyInfo.size();
172 }
173
174 std::vector<VehicleRigidBodyInfo> mVehicleRigidBodyInfo;
175 std::vector<VehicleJointInfo> mVehicleJointInfo;
176
177 };
178
179
180}
181
double Real
Definition Typedef.inl:23
std::vector< VehicleRigidBodyInfo > mVehicleRigidBodyInfo
VehicleBind(int size)
std::vector< VehicleJointInfo > mVehicleJointInfo
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
ConfigJointType
Definition VehicleInfo.h:32
@ Point
Definition VehicleInfo.h:37
@ BallAndSocket
Definition VehicleInfo.h:33
@ OtherJoint
Definition VehicleInfo.h:38
@ Slider
Definition VehicleInfo.h:34
@ Hinge
Definition VehicleInfo.h:35
@ Fixed
Definition VehicleInfo.h:36
ConfigShapeType
Definition VehicleInfo.h:22
@ Sphere
Definition VehicleInfo.h:26
@ OtherShape
Definition VehicleInfo.h:28
@ Capsule
Definition VehicleInfo.h:25
Transform< float, 3 > Transform3f
Vector< float, 3 > Vec3f
Definition Vector3D.h:93
unsigned int uint
Definition VkProgram.h:14
ConfigMotionType
Definition VehicleInfo.h:15
@ CMT_Static
Definition VehicleInfo.h:16
@ CMT_Dynamic
Definition VehicleInfo.h:18
@ CMT_Kinematic
Definition VehicleInfo.h:17
std::string name
Definition VehicleInfo.h:52
Name_Shape(std::string n, int Id=-1)
Definition VehicleInfo.h:45
Vector< Real, 3 > mAnchorPoint
ConfigJointType mJointType
Name_Shape mRigidBodyName_2
VehicleJointInfo(Name_Shape Name1, Name_Shape Name2, ConfigJointType typeIn, Vector< Real, 3 > Axi=Vec3f(1, 0, 0), Vector< Real, 3 > Point=Vec3f(0), bool Moter=false, Real moter=0, bool Range=false, Real min=0, Real max=0)
Name_Shape mRigidBodyName_1
Vector< Real, 3 > mAxis
VehicleRigidBodyInfo(Name_Shape name, int shapeId, ConfigShapeType type, Transform3f trans, Real density=100)
Definition VehicleInfo.h:72
std::vector< Vec3f > tet
Definition VehicleInfo.h:91
ConfigMotionType motion
Definition VehicleInfo.h:93
ConfigShapeType shapeType
Definition VehicleInfo.h:85
VehicleRigidBodyInfo(Name_Shape name, int shapeId, ConfigShapeType type, Real density=100)
Definition VehicleInfo.h:64
#define max(x, y)
Definition svd3_cuda.h:41