Go to the documentation of this file.00001 #ifndef OPENTISSUE_COLLISION_GJK_GJK_OUTSIDE_EDGE_FACE_VORONOI_PLANE_H
00002 #define OPENTISSUE_COLLISION_GJK_GJK_OUTSIDE_EDGE_FACE_VORONOI_PLANE_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/math_is_number.h>
00013
00014 #include <cassert>
00015
00016 namespace OpenTissue
00017 {
00018 namespace gjk
00019 {
00020
00021 namespace detail
00022 {
00023
00038 template< typename V >
00039 inline bool outside_edge_face_voronoi_plane(
00040 V const & p
00041 , V const & A
00042 , V const & B
00043 , V const & C
00044 )
00045 {
00046 typedef typename V::value_traits value_traits;
00047 typedef typename V::value_type T;
00048
00049 V const m = cross( A-C, B-C );
00050 assert( dot( m, m ) > value_traits::zero() || !"outside_edge_face_voronoi_plane(): Degenerate triangle encountered");
00051
00052 V const n = cross( B-A, m );
00053 T const sign_p = dot( n, p-B );
00054 T const sign_C = dot( n, C-B );
00055
00056 assert( is_number( sign_p ) || !"outside_edge_face_voronoi_plane(): Not a Number encountered");
00057 assert( is_number( sign_C ) || !"outside_edge_face_voronoi_plane(): Not a Number encountered");
00058
00059 return (sign_p*sign_C) <= value_traits::zero();
00060 }
00061
00062 }
00063
00064 }
00065
00066 }
00067
00068
00069 #endif