1 #ifndef SimTK_SIMMATH_CONTACT_GEOMETRY_H_
2 #define SimTK_SIMMATH_CONTACT_GEOMETRY_H_
46 class ContactGeometryImpl;
47 class OBBTreeNodeImpl;
232 const Vec3& startingGuessForClosestPoint,
233 Vec3& newClosestPointOnSurface,
234 Vec3& closestPointOnLine,
358 const Mat33& Hessian)
const;
364 return calcGaussianCurvature(calcSurfaceGradient(point),
365 calcSurfaceHessian(point));
456 const Vec3& d2Pdu2,
const Vec3& d2Pdv2,
636 const UnitVec3& defaultDirectionIfNeeded,
669 const Vec2& initSensitivity =
Vec2(0,1))
const;
703 const Vec3 r_PQ = xQ - xP;
704 const Real lengthHint = r_PQ.
norm();
705 const UnitVec3 n = calcSurfaceUnitNormal(xP);
707 const Vec3 t_PQ = r_PQ - (~r_PQ*n)*n;
710 tLength != 0 ?
UnitVec3(t_PQ/tLength,
true)
712 calcGeodesicUsingOrthogonalMethod(xP, xQ,
Vec3(tPhint), lengthHint, geod);
810 const ContactGeometryImpl&
getImpl()
const {assert(impl);
return *impl;}
812 ContactGeometryImpl&
updImpl() {assert(impl);
return *impl; }
840 {
return geo.
getTypeId()==classTypeId(); }
843 { assert(isInstance(geo));
return static_cast<const HalfSpace&
>(geo); }
846 { assert(isInstance(geo));
return static_cast<HalfSpace&
>(geo); }
872 {
return geo.
getTypeId()==classTypeId(); }
875 { assert(isInstance(geo));
return static_cast<const Cylinder&
>(geo); }
878 { assert(isInstance(geo));
return static_cast<Cylinder&
>(geo); }
903 {
return geo.
getTypeId()==classTypeId(); }
906 { assert(isInstance(geo));
return static_cast<const Sphere&
>(geo); }
909 { assert(isInstance(geo));
return static_cast<Sphere&
>(geo); }
1035 {
return geo.
getTypeId()==classTypeId(); }
1038 { assert(isInstance(geo));
return static_cast<const Ellipsoid&
>(geo); }
1041 { assert(isInstance(geo));
return static_cast<Ellipsoid&
>(geo); }
1084 {
return geo.
getTypeId()==classTypeId(); }
1087 { assert(isInstance(geo));
return static_cast<const SmoothHeightMap&
>(geo); }
1090 { assert(isInstance(geo));
return static_cast<SmoothHeightMap&
>(geo); }
1123 {
return geo.
getTypeId()==classTypeId(); }
1126 { assert(isInstance(geo));
return static_cast<const Brick&
>(geo); }
1129 { assert(isInstance(geo));
return static_cast<Brick&
>(geo); }
1318 {
return geo.
getTypeId()==classTypeId(); }
1321 { assert(isInstance(geo));
return static_cast<const TriangleMesh&
>(geo); }
1324 { assert(isInstance(geo));
return static_cast<TriangleMesh&
>(geo); }
1366 const OBBTreeNodeImpl* impl;
1387 {
return geo.
getTypeId()==classTypeId(); }
1390 { assert(isInstance(geo));
return static_cast<const Torus&
>(geo); }
1393 { assert(isInstance(geo));
return static_cast<Torus&
>(geo); }
1416 Plane() : m_normal(1,0,0), m_offset(0) { }
1418 : m_normal(normal), m_offset(offset) { }
1421 return ~m_normal*pt - m_offset;
1472 endpt[0] = q[0]; endpt[1] = q[1]; endpt[2] = q[2];
1473 shouldTerminate =
true;
1485 enabled = enabledFlag;
1493 mutable Plane plane;
1504 m_x(x), m_O(O), m_I(
I), m_color(color) { }
1511 P[0] = m_x[0]; P[1] = m_x[1]; P[2] = m_x[2];
1512 Q[0] = m_x[3]; Q[1] = m_x[4]; Q[2] = m_x[5];
1521 .setLineThickness(2));
1524 .setLineThickness(2));
1532 const Vec3& m_color;
1544 m_plane(plane), m_color(color) { }
1557 .setTransform(
Transform(R_plane, R_plane*offset))
1559 .setOpacity(
Real(.2)));
1563 const Plane& m_plane;
1564 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:1442
GeodHitPlaneEvent()
Definition: ContactGeometry.h:1444
const bool isEnabled()
Definition: ContactGeometry.h:1488
void setPlane(const Plane &aplane) const
Definition: ContactGeometry.h:1476
const Plane & getPlane() const
Definition: ContactGeometry.h:1480
GeodHitPlaneEvent(const Plane &aplane)
Definition: ContactGeometry.h:1447
const void setEnabled(bool enabledFlag)
Definition: ContactGeometry.h:1484
Real getValue(const State &state) const override
Get the value of the event trigger function for a State.
Definition: ContactGeometry.h:1453
void handleEvent(State &state, Real accuracy, bool &shouldTerminate) const override
This method is invoked to handle the event.
Definition: ContactGeometry.h:1464
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:1501
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:1506
PathDecorator(const Vector &x, const Vec3 &O, const Vec3 &I, const Vec3 &color)
Definition: ContactGeometry.h:1503
This class generates decoration for a plane.
Definition: ContactGeometry.h:1541
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:1546
PlaneDecorator(const Plane &plane, const Vec3 &color)
Definition: ContactGeometry.h:1543
A simple plane class.
Definition: ContactGeometry.h:1414
Real getOffset() const
Definition: ContactGeometry.h:1428
Vec3 getNormal() const
Definition: ContactGeometry.h:1424
Real getDistance(const Vec3 &pt) const
Definition: ContactGeometry.h:1420
Plane(const Vec3 &normal, const Real &offset)
Definition: ContactGeometry.h:1417
Plane()
Definition: ContactGeometry.h:1416
This class provides a description of a mesh made of polygonal faces (not limited to triangles).
Definition: PolygonalMesh.h:71
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 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:606
Transform_< Real > Transform
Definition: Transform.h:44
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)