1 #ifndef SimTK_SIMMATH_CONTACT_GEOMETRY_H_
2 #define SimTK_SIMMATH_CONTACT_GEOMETRY_H_
47 class ContactGeometryImpl;
48 class OBBTreeNodeImpl;
260 const Vec3& startingGuessForClosestPoint,
261 Vec3& newClosestPointOnSurface,
262 Vec3& closestPointOnLine,
269 MaxIterationsExceeded,
270 PointFallsBelowSurface,
310 Vec3& nearestPointOnLine)
const;
431 const Mat33& Hessian)
const;
437 return calcGaussianCurvature(calcSurfaceGradient(point),
438 calcSurfaceHessian(point));
539 const Vec3& d2Pdu2,
const Vec3& d2Pdv2,
675 const Vec3& initialPointApprox,
676 const Vec3& initialTangentApprox,
678 int numberOfKnotPoints,
680 geodesicKnotPointsSink)
const;
705 const Vec3& initialPointApprox,
706 const Vec3& initialTangentApprox,
708 Real initialIntegratorStepSize,
709 Real integratorAccuracy,
710 Real constraintTolerance,
713 geodesicKnotPointsSink)
const;
788 const UnitVec3& defaultDirectionIfNeeded,
821 const Vec2& initSensitivity =
Vec2(0,1))
const;
855 const Vec3 r_PQ = xQ - xP;
856 const Real lengthHint = r_PQ.
norm();
857 const UnitVec3 n = calcSurfaceUnitNormal(xP);
859 const Vec3 t_PQ = r_PQ - (~r_PQ*n)*n;
862 tLength != 0 ?
UnitVec3(t_PQ/tLength,
true)
864 calcGeodesicUsingOrthogonalMethod(xP, xQ,
Vec3(tPhint), lengthHint, geod);
962 const ContactGeometryImpl&
getImpl()
const {assert(impl);
return *impl;}
964 ContactGeometryImpl&
updImpl() {assert(impl);
return *impl; }
992 {
return geo.
getTypeId()==classTypeId(); }
995 { assert(isInstance(geo));
return static_cast<const HalfSpace&
>(geo); }
998 { assert(isInstance(geo));
return static_cast<HalfSpace&
>(geo); }
1024 {
return geo.
getTypeId()==classTypeId(); }
1027 { assert(isInstance(geo));
return static_cast<const Cylinder&
>(geo); }
1030 { assert(isInstance(geo));
return static_cast<Cylinder&
>(geo); }
1055 {
return geo.
getTypeId()==classTypeId(); }
1058 { assert(isInstance(geo));
return static_cast<const Sphere&
>(geo); }
1061 { assert(isInstance(geo));
return static_cast<Sphere&
>(geo); }
1187 {
return geo.
getTypeId()==classTypeId(); }
1190 { assert(isInstance(geo));
return static_cast<const Ellipsoid&
>(geo); }
1193 { assert(isInstance(geo));
return static_cast<Ellipsoid&
>(geo); }
1236 {
return geo.
getTypeId()==classTypeId(); }
1239 { assert(isInstance(geo));
return static_cast<const SmoothHeightMap&
>(geo); }
1242 { assert(isInstance(geo));
return static_cast<SmoothHeightMap&
>(geo); }
1275 {
return geo.
getTypeId()==classTypeId(); }
1278 { assert(isInstance(geo));
return static_cast<const Brick&
>(geo); }
1281 { assert(isInstance(geo));
return static_cast<Brick&
>(geo); }
1470 {
return geo.
getTypeId()==classTypeId(); }
1473 { assert(isInstance(geo));
return static_cast<const TriangleMesh&
>(geo); }
1476 { assert(isInstance(geo));
return static_cast<TriangleMesh&
>(geo); }
1518 const OBBTreeNodeImpl* impl;
1539 {
return geo.
getTypeId()==classTypeId(); }
1542 { assert(isInstance(geo));
return static_cast<const Torus&
>(geo); }
1545 { assert(isInstance(geo));
return static_cast<Torus&
>(geo); }
1568 Plane() : m_normal(1,0,0), m_offset(0) { }
1570 : m_normal(normal), m_offset(offset) { }
1573 return ~m_normal*pt - m_offset;
1624 endpt[0] = q[0]; endpt[1] = q[1]; endpt[2] = q[2];
1625 shouldTerminate =
true;
1637 enabled = enabledFlag;
1645 mutable Plane plane;
1656 m_x(x), m_O(O), m_I(
I), m_color(color) { }
1663 P[0] = m_x[0]; P[1] = m_x[1]; P[2] = m_x[2];
1664 Q[0] = m_x[3]; Q[1] = m_x[4]; Q[2] = m_x[5];
1673 .setLineThickness(2));
1676 .setLineThickness(2));
1684 const Vec3& m_color;
1696 m_plane(plane), m_color(color) { }
1709 .setTransform(
Transform(R_plane, R_plane*offset))
1711 .setOpacity(
Real(.2)));
1715 const Plane& m_plane;
1716 const Vec3& m_color;
This file defines the BicubicSurface class, and the BicubicFunction class that uses it to create a tw...
This file defines the Geodesic class.
Includes internal headers providing declarations for the basic SimTK Core classes,...
This is the header file that every Simmath compilation unit should include first.
#define SimTK_SIMMATH_EXPORT
Definition: SimTKmath/include/simmath/internal/common.h:64
This Array_ helper class is the base class for ArrayView_ which is the base class for Array_; here we...
Definition: Array.h:324
void push_back(const T &value)
This method increases the size of the Array by one element at the end and initializes that element by...
Definition: Array.h:2399
This class will create a smooth surface that approximates a two-argument function F(X,...
Definition: BicubicSurface.h:158
Definition: CoordinateAxis.h:194
A DecorationGenerator is used to define geometry that may change over the course of a simulation.
Definition: DecorationGenerator.h:45
This defines a rectangular solid centered at the origin and aligned with the local frame axes.
Definition: DecorativeGeometry.h:426
This is the client-side interface to an implementation-independent representation of "Decorations" su...
Definition: DecorativeGeometry.h:86
A line between two points.
Definition: DecorativeGeometry.h:306
This defines a sphere centered at the origin.
Definition: DecorativeGeometry.h:367
A 3d rectangular box aligned with an unspecified frame F and centered at that frame's origin.
Definition: Geo_Box.h:48
A event handler to terminate integration when geodesic hits the plane.
Definition: ContactGeometry.h:1594
GeodHitPlaneEvent()
Definition: ContactGeometry.h:1596
const bool isEnabled()
Definition: ContactGeometry.h:1640
void setPlane(const Plane &aplane) const
Definition: ContactGeometry.h:1628
const Plane & getPlane() const
Definition: ContactGeometry.h:1632
GeodHitPlaneEvent(const Plane &aplane)
Definition: ContactGeometry.h:1599
const void setEnabled(bool enabledFlag)
Definition: ContactGeometry.h:1636
Real getValue(const State &state) const override
Get the value of the event trigger function for a State.
Definition: ContactGeometry.h:1605
void handleEvent(State &state, Real accuracy, bool &shouldTerminate) const override
This method is invoked to handle the event.
Definition: ContactGeometry.h:1616
This class stores options for calculating geodesics.
Definition: Geodesic.h:311
This class stores a geodesic curve after it has been determined.
Definition: Geodesic.h:51
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: Mat.h:97
TODO.
Definition: OBBTree.h:100
This class represents a rectangular box with arbitrary position and orientation.
Definition: OrientedBoundingBox.h:42
This class generates decoration for contact points and straight line path segments.
Definition: ContactGeometry.h:1653
virtual void generateDecorations(const State &state, Array_< DecorativeGeometry > &geometry) override
This will be called every time a new State is about to be visualized.
Definition: ContactGeometry.h:1658
PathDecorator(const Vector &x, const Vec3 &O, const Vec3 &I, const Vec3 &color)
Definition: ContactGeometry.h:1655
This class generates decoration for a plane.
Definition: ContactGeometry.h:1693
virtual void generateDecorations(const State &state, Array_< DecorativeGeometry > &geometry) override
This will be called every time a new State is about to be visualized.
Definition: ContactGeometry.h:1698
PlaneDecorator(const Plane &plane, const Vec3 &color)
Definition: ContactGeometry.h:1695
A simple plane class.
Definition: ContactGeometry.h:1566
Real getOffset() const
Definition: ContactGeometry.h:1580
Vec3 getNormal() const
Definition: ContactGeometry.h:1576
Real getDistance(const Vec3 &pt) const
Definition: ContactGeometry.h:1572
Plane(const Vec3 &normal, const Real &offset)
Definition: ContactGeometry.h:1569
Plane()
Definition: ContactGeometry.h:1568
This class provides a description of a mesh made of polygonal faces (not limited to triangles).
Definition: PolygonalMesh.h:79
Rotation_ & setRotationFromOneAxis(const UnitVec3P &uvec, CoordinateAxis axis)
Calculate R_AB by knowing one of B's unit vectors expressed in A.
ScheduledEventReporter is a subclass of EventReporter for events that occur at a particular time that...
Definition: EventReporter.h:72
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:66
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
const Vector & getQ(SubsystemIndex) const
Per-subsystem access to the global shared variables.
TriggeredEventHandler is a subclass of EventHandler for events that occur when some condition is sati...
Definition: EventHandler.h:109
UnitVec< P, 1 > perp() const
Return a new unit vector perpendicular to this one but otherwise arbitrary.
Definition: UnitVec.h:181
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Vec.h:610
Vec< 2 > Vec2
This is the most common 2D vector type: a column of 2 Real values stored consecutively in memory (pac...
Definition: SmallMatrix.h:126
Vec< 3 > Vec3
This is the most common 3D vector type: a column of 3 Real values stored consecutively in memory (pac...
Definition: SmallMatrix.h:129
const Real NaN
This is the IEEE "not a number" constant for this implementation of the default-precision Real type; ...
const Complex I
We only need one complex constant, i = sqrt(-1). For the rest just multiply the real constant by i,...
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
const Vec3 Black
RGB=( 0, 0, 0)
UnitVec< Real, 1 > UnitVec3
Definition: UnitVec.h:41
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:607
Transform_< Real > Transform
Definition: Transform.h:44
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)