PeriDyno 1.0.0
Loading...
Searching...
No Matches
AdditiveCCD.h
Go to the documentation of this file.
1
16#pragma once
17#include "Vector.h"
30
31namespace dyno
32{
33 template<typename T>
35 {
36 public:
37
38 DYN_FUNC AdditiveCCD(T xi_, T s_, T tc_)
39 : xi(xi_), s(s_), tc(tc_) {
40 };
41 DYN_FUNC AdditiveCCD() = default;
42 //default: this is a normal CCD board phrase as thickness = 0, that return TOI as distance >0; TOI in[0,1]
43 //with CA strategy.
44
55
56 inline DYN_FUNC bool VertexFaceCCD(
57 const Vector<T, 3>& x0, const Vector<T, 3>& x1, const Vector<T, 3>& x2, const Vector<T, 3>& x3,
58 const Vector<T, 3>& y0, const Vector<T, 3>& y1, const Vector<T, 3>& y2, const Vector<T, 3>& y3,
59 T& time, T invL);
60
72
73
74 inline DYN_FUNC bool EdgeEdgeCCD(
75 const Vector<T, 3>& x0, const Vector<T, 3>& x1, const Vector<T, 3>& x2, const Vector<T, 3>& x3,
76 const Vector<T, 3>& y0, const Vector<T, 3>& y1, const Vector<T, 3>& y2, const Vector<T, 3>& y3,
77 T& time, T invL);
78
79
91
92 inline DYN_FUNC bool TriangleCCD(
95 Real& toi);
96
104 inline DYN_FUNC void projectClosePoint(
105 const TTriangle3D<Real>& s, const TTriangle3D<Real>& t,
106 Vector<T,3> & first, Vector<T,3> &second);
107
108 private:
109
110
111 inline DYN_FUNC Vector<T, 3> DistanceEE(
112 const Vector<T, 3>& x0, const Vector<T, 3>& x1,
113 const Vector<T, 3>& y0, const Vector<T, 3>& y1,
114 T* para);
115
116 inline DYN_FUNC T DistanceVF(
117 const Vector<T, 3>& x,
118 const Vector<T, 3>& y0,
119 const Vector<T, 3>& y1,
120 const Vector<T, 3>& y2);
121
122 inline DYN_FUNC Vector<T, 3> DistanceVF_v(
123 const Vector<T, 3>& x,
124 const Vector<T, 3>& y0,
125 const Vector<T, 3>& y1,
126 const Vector<T, 3>& y2,
127 T* para);
128
129 DYN_FUNC T SquareDistanceVF(const Vector<T, 3>& x0, const Vector<T, 3>& x1, const Vector<T, 3>& x2,
130 const Vector<T, 3>& x3);
131
132 DYN_FUNC T SquareDistanceEE(
133 const Vector<T, 3>& x0, const Vector<T, 3>& x1,
134 const Vector<T, 3>& x2, const Vector<T, 3>& x3);
135
136 T s = 0.2 ; //separation rescale, usually <<1 in [0,1].
137 T xi = 0.0; // thickness required, rescalar to max primitive length (e.g. xi times of max edge of triangle)
138 T tc = 0.95; // intuitive time-to-collide lower bound, can simply set as 1.
139 };
140}
141
142#include "AdditiveCCD.inl"
double Real
Definition Typedef.inl:23
DYN_FUNC Vector< T, 3 > DistanceVF_v(const Vector< T, 3 > &x, const Vector< T, 3 > &y0, const Vector< T, 3 > &y1, const Vector< T, 3 > &y2, T *para)
DYN_FUNC AdditiveCCD(T xi_, T s_, T tc_)
Definition AdditiveCCD.h:38
DYN_FUNC AdditiveCCD()=default
DYN_FUNC T DistanceVF(const Vector< T, 3 > &x, const Vector< T, 3 > &y0, const Vector< T, 3 > &y1, const Vector< T, 3 > &y2)
DYN_FUNC bool VertexFaceCCD(const Vector< T, 3 > &x0, const Vector< T, 3 > &x1, const Vector< T, 3 > &x2, const Vector< T, 3 > &x3, const Vector< T, 3 > &y0, const Vector< T, 3 > &y1, const Vector< T, 3 > &y2, const Vector< T, 3 > &y3, T &time, T invL)
Do a continuous collision detection between a vertex and a triangle.
DYN_FUNC Vector< T, 3 > DistanceEE(const Vector< T, 3 > &x0, const Vector< T, 3 > &x1, const Vector< T, 3 > &y0, const Vector< T, 3 > &y1, T *para)
DYN_FUNC bool TriangleCCD(TTriangle3D< Real > &s0, TTriangle3D< Real > &s1, TTriangle3D< Real > &t0, TTriangle3D< Real > &t1, Real &toi)
Do a continuous collision detection between two triangles.
DYN_FUNC bool EdgeEdgeCCD(const Vector< T, 3 > &x0, const Vector< T, 3 > &x1, const Vector< T, 3 > &x2, const Vector< T, 3 > &x3, const Vector< T, 3 > &y0, const Vector< T, 3 > &y1, const Vector< T, 3 > &y2, const Vector< T, 3 > &y3, T &time, T invL)
Do a continuous collision detection between two edges.
DYN_FUNC void projectClosePoint(const TTriangle3D< Real > &s, const TTriangle3D< Real > &t, Vector< T, 3 > &first, Vector< T, 3 > &second)
find the close point between two triangles, store their barycentric coordinates ordered as vertex.
DYN_FUNC T SquareDistanceEE(const Vector< T, 3 > &x0, const Vector< T, 3 > &x1, const Vector< T, 3 > &x2, const Vector< T, 3 > &x3)
DYN_FUNC T SquareDistanceVF(const Vector< T, 3 > &x0, const Vector< T, 3 > &x1, const Vector< T, 3 > &x2, const Vector< T, 3 > &x3)
#define T(t)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25