1 #ifndef MATH3D_GEOMETRY3D_H 2 #define MATH3D_GEOMETRY3D_H 9 #include "Triangle3D.h" 13 #include "Cylinder3D.h" 14 #include "Ellipsoid3D.h" 15 #include "Polygon3D.h" 16 #include "Polyhedron3D.h" 17 #include <KrisLibrary/utils/AnyValue.h> 36 enum Type { Empty, Point, Segment, Triangle, Polygon, Sphere, Ellipsoid, Cylinder, AABB, Box };
49 static const char* TypeName(Type type);
50 const char* TypeName()
const {
return GeometricPrimitive3D::TypeName(type); }
55 void Transform(
const Matrix4& T);
57 static bool SupportsCollides(Type a,Type b);
58 bool SupportsCollides(Type b)
const {
return GeometricPrimitive3D::SupportsCollides(type,b); }
59 bool Collides(
const Vector3& pt)
const;
63 bool Collides(
const Sphere3D& s)
const;
66 bool Collides(
const AABB3D& s)
const;
67 bool Collides(
const Box3D& s)
const;
69 static bool SupportsDistance(Type a,Type b);
70 bool SupportsDistance(Type b)
const {
return GeometricPrimitive3D::SupportsDistance(type,b); }
71 Real Distance(
const Vector3& pt)
const;
75 Real Distance(
const Sphere3D& s)
const;
78 Real Distance(
const AABB3D& s)
const;
79 Real Distance(
const Box3D& s)
const;
81 std::vector<double> ClosestPointParameters(
const Vector3& pt)
const;
82 Vector3 ParametersToPoint(
const std::vector<double>& params)
const;
83 Vector3 ParametersToNormal(
const std::vector<double>& params)
const;
85 static bool SupportsClosestPoints(Type a,Type b);
A generic 3D geometric primitive class.
Definition: geometry3d.h:33
The namespace for all classes/functions in the Meshing package.
Definition: AnyGeometry.h:11
A 3D vector class.
Definition: math3d/primitives.h:136
An arbitrary connected polygon in 3D space given by a vertex list.
Definition: Polygon3D.h:21
A polymorphic container class that can contain data of any type.
Definition: AnyValue.h:25
A 3D axis-aligned bounding box.
Definition: AABB3D.h:13
A 3D sphere class.
Definition: Sphere3D.h:21
A 4x4 matrix class.
Definition: math3d/primitives.h:626
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13
A 3D ellipsoidThe ellipsoid is the centered unit sphere [-1,1]^3 set in the scaled local coordinate s...
Definition: Ellipsoid3D.h:16
A 3D triangle class.
Definition: Triangle3D.h:26
A 3D cylinder.
Definition: Cylinder3D.h:19
A 3D boxThe box is the unit cube [0,1]^3 set in the scaled local coordinate system. That is, one corner is at the origin, and it has dimensions [dims.x,dims.y,dims.z] in the coordinates given by {xbasis,ybasis,zbasis}.
Definition: Box3D.h:21
Definition: Segment3D.h:12
bool SupportsClosestPoints(Type b) const
Definition: geometry3d.h:93
Real ClosestPoints(const Vector3 &pt, Vector3 &cp, Vector3 &direction) const
Definition: geometry3d.cpp:1229