Blender
V3.3
|
Class for colliding triangles. More...
#include <gim_tri_collision.h>
Public Attributes | |
btScalar | m_margin |
btVector3 | m_vertices [3] |
Class for colliding triangles.
Definition at line 120 of file gim_tri_collision.h.
|
inline |
Definition at line 126 of file gim_tri_collision.h.
|
inline |
Definition at line 146 of file gim_tri_collision.h.
References m_vertices.
|
inline |
Test boxes before doing hard test.
other | Triangle for collide |
contact_data | Structure for holding contact points, normal and penetration depth; The normal is pointing toward this triangle from the other triangle \ |
Definition at line 201 of file gim_tri_collision.h.
References collide_triangle_hard_test(), GIM_AABB::has_collision(), m_margin, and m_vertices.
bool GIM_TRIANGLE::collide_triangle_hard_test | ( | const GIM_TRIANGLE & | other, |
GIM_TRIANGLE_CONTACT_DATA & | contact_data | ||
) | const |
Test triangles by finding separating axis.
other | Triangle for collide |
contact_data | Structure for holding contact points, normal and penetration depth; The normal is pointing toward this triangle from the other triangle |
Definition at line 610 of file gim_tri_collision.cpp.
References m_margin, m_vertices, and GIM_TRIANGLE_CALCULATION_CACHE::triangle_collision().
Referenced by collide_triangle().
|
inline |
Definition at line 130 of file gim_tri_collision.h.
References m_margin, and m_vertices.
|
inline |
Definition at line 153 of file gim_tri_collision.h.
References btVector3, EDGE_PLANE, m_vertices, and triangle_normal().
Referenced by is_point_inside().
|
inline |
Definition at line 135 of file gim_tri_collision.h.
References m_vertices, normal, and TRIANGLE_NORMAL.
Referenced by get_triangle_transform().
|
inline |
Definition at line 140 of file gim_tri_collision.h.
References m_vertices, and TRIANGLE_PLANE.
Referenced by GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::retrieve_node0_triangle(), and GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::retrieve_node1_triangle().
|
inline |
Gets the relative transformation of this triangle.
The transformation is oriented to the triangle normal , and aligned to the 1st edge of this triangle. The position corresponds to vertice 0:
Definition at line 167 of file gim_tri_collision.h.
References btMatrix3x3, btVector3, get_normal(), m_vertices, MAT_SET_X, MAT_SET_Y, MAT_SET_Z, and VEC_NORMALIZE.
|
inline |
Solve the System for u,v parameters:
u*axe1[i1] + v*axe2[i1] = vecproj[i1] u*axe1[i2] + v*axe2[i2] = vecproj[i2]
sustitute: v = (vecproj[i2] - u*axe1[i2])/axe2[i2]
then the first equation in terms of 'u':
--> u*axe1[i1] + ((vecproj[i2] - u*axe1[i2])/axe2[i2])*axe2[i1] = vecproj[i1]
--> u*axe1[i1] + vecproj[i2]*axe2[i1]/axe2[i2] - u*axe1[i2]*axe2[i1]/axe2[i2] = vecproj[i1]
--> u*(axe1[i1] - axe1[i2]*axe2[i1]/axe2[i2]) = vecproj[i1] - vecproj[i2]*axe2[i1]/axe2[i2]
--> u*((axe1[i1]*axe2[i2] - axe1[i2]*axe2[i1])/axe2[i2]) = (vecproj[i1]*axe2[i2] - vecproj[i2]*axe2[i1])/axe2[i2]
--> u*(axe1[i1]*axe2[i2] - axe1[i2]*axe2[i1]) = vecproj[i1]*axe2[i2] - vecproj[i2]*axe2[i1]
--> u = (vecproj[i1]*axe2[i2] - vecproj[i2]*axe2[i1]) /(axe1[i1]*axe2[i2] - axe1[i2]*axe2[i1])
if 0.0<= u+v <=1.0 then they are inside of triangle
\return false if the point is outside of triangle.This function doesn't take the margin
Definition at line 242 of file gim_tri_collision.h.
References btFabs(), btVector3, G_EPSILON, GUINT, m_vertices, point, and v.
|
inline |
is point in triangle beam?
Test if point is in triangle, with m_margin tolerance
Definition at line 291 of file gim_tri_collision.h.
References DISTANCE_PLANE_POINT, get_edge_plane(), GREAL, m_margin, and point.
Referenced by ray_collision(), and ray_collision_front_side().
|
inline |
Bidireccional ray collision.
Definition at line 310 of file gim_tri_collision.h.
References btVector3, GUINT, is_point_inside(), LINE_PLANE_COLLISION(), m_vertices, triangle_normal(), VEC_CROSS, and VEC_NORMALIZE.
|
inline |
one direccion ray collision
Definition at line 342 of file gim_tri_collision.h.
References btVector3, GUINT, is_point_inside(), LINE_PLANE_COLLISION(), m_vertices, triangle_normal(), VEC_CROSS, and VEC_NORMALIZE.
btScalar GIM_TRIANGLE::m_margin |
Definition at line 123 of file gim_tri_collision.h.
Referenced by collide_triangle(), collide_triangle_hard_test(), get_box(), is_point_inside(), and GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::node_collision().
btVector3 GIM_TRIANGLE::m_vertices[3] |
Definition at line 124 of file gim_tri_collision.h.
Referenced by apply_transform(), collide_triangle(), collide_triangle_hard_test(), get_box(), get_edge_plane(), get_normal(), get_plane(), get_triangle_transform(), get_uv_parameters(), GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::node_collision(), ray_collision(), ray_collision_front_side(), GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::retrieve_node0_triangle(), and GIM_TREE_TREE_COLLIDER< BOX_SET_CLASS0, BOX_SET_CLASS1 >::retrieve_node1_triangle().