VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
kinematicTools.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 
11 #include <math.h>
12 #include <errno.h>
13 #include <matrix/LibMatrix.h>
14 #include <vl/topoView.h>
15 #include <matrix/vlTaitBryan.h>
16 #include <matrix/3dBoundingVolume.h>
17 
18 #include "tdbutil/mathUtilities.h"
19 
20 #include <map>
21 
23 #include <boost/math/special_functions/fpclassify.hpp>
24 
25 #define DtSIGN(x) (((x) > (0.0)) ? (1.0) : (-1.0))
26 
27 #define DtALMOST(x, y, e) (((x)<=((y)+(e))) && ((x)>=((y)-(e))))
28 
29 #define DtGRAVITY_CONSTANT (9.81)
30 #define DtPI_OVER_TWO (1.570796327)
31 #define DtTWO_PI (6.283185307)
32 #define DtMETERS_TO_FEET (3.2808)
33 #define DtMETERS_PER_SEC_TO_MPH (2.23)
34 #define DtLN2 (0.693147181)
35 #define DtNM_2_METERS (1852.0)
36 
37 #define SIN(x) DtSin(x)
38 #define COS(x) DtCos(x)
39 #define TAN(x) DtTan(x)
40 
41 #define ASIN(x) DtAsin(x)
42 #define ACOS(x) DtAcos(x)
43 #define ATAN(x) DtAtan(x)
44 #define ATAN2(y, x) DtAtan2((y), (x))
45 
46 #define DtFRand() ((double) rand() / RAND_MAX)
47 #define DtIRandom(from, to) DtIntRandom(from, to)
48 
49 class DtGeodeticCoord;
50 class Coordinate_System;
51 class DtChord;
52 class DtExtent;
53 class DtLocalVector;
54 class DtLocalVertexList;
55 class DtListItem;
57 class DtPoint;
60 
61 #include "vrfutil/vrfutilDefines.h"
62 
65 DT_DLL_vrfutil double gRand();
66 
70 DT_DLL_vrfutil double centralLimitGaussian(int numDraws);
71 
77 
78 DT_DLL_vrfutil void Dt3DKinematicsTick(const DtVector& Position,
79  const DtVector& LinearVelocity,
80  const DtVector& LinearAcceleration,
81  DtConstDcm orientation,
82  const DtVector& angVelocity,
83  const DtVector& angAcceleration,
84  double DeltaTime,
85  DtVectorRef newPosition,
86  DtVectorRef newVelocity,
87  DtDcm& newOrientation,
88  DtVectorRef newAngVelocity);
89 
90 DT_DLL_vrfutil void Dt3DDynamicsTick(const DtVector& LinearForce,
91  double vehicleMass,
92  DtVectorRef newLinearAcceleration,
93  const DtVector& torque,
94  DtConstDcm vehicleInertia,
95  DtVectorRef newAngAcceleration);
96 
97 DT_DLL_vrfutil void DtGravityForce(double mass,
98  DtVectorRef returnForce);
99 
100 DT_DLL_vrfutil void DtResolve(const DtVector& forcePos,
101  const DtVector& force,
102  DtVectorRef resultTorqueAboutOrigin);
103 
104 DT_DLL_vrfutil void DtParallelAxisTheorem(DtConstDcm inertiaInOriginalFrame,
105  double mass,
106  const DtVector& newToOriginal,
107  DtDcm& inertiaInNewFrame);
108 
109 DT_DLL_vrfutil void DtRotateInertia(DtDcm inertiaInOriginalFrame,
110  DtDcm originalToNew,
111  DtDcm& inertiaInNewFrame);
112 
113 DT_DLL_vrfutil double DtPIDServo(double error,
114  double errorIntegral,
115  double velocity,
116  double proportionalGain,
117  double integralGain,
118  double derivativeGain,
119  double biasForce = 0.0,
120  double* control = 0);
121 
135  const double deceleration, const double dt, const double ownSpeed,
136  const double distance, const double targetSpeed, const double errorDecelValue = -1e10);
137 
151  const double deceleration, const double dt, const double ownSpeed,
152  const double distance, const double targetSpeed, const double errorDecelValue = -1e10);
153 
154 
155 DT_DLL_vrfutil void DtBlockInertia(const double xLen,
156  const double yLen,
157  const double zLen,
158  const double mass,
159  DtDcm& inertia);
160 
162  double tolerance = 0.0);
163 
164 DT_DLL_vrfutil void DtDcmFromColumns(DtDcm& result,
165  const DtVector& col1,
166  const DtVector& col2,
167  const DtVector& col3);
168 
169 DT_DLL_vrfutil void DtDcmFromRows(DtDcm& result,
170  const DtVector& row1,
171  const DtVector& row2,
172  const DtVector& row3);
173 
174 
175 
184 DT_DLL_vrfutil bool DtPointInCone(const DtVector& coneEndPosition,
185  const DtVector& coneAxis,
186  const double coneAngle,
187  const DtVector& testPoint,
188  double* testAnglePtr = 0);
189 
190 
191 DT_DLL_vrfutil bool DtPointInWedge(const DtVector& wedgeEndPosition,
192  const DtVector& wedgeAxis,
193  const double wedgeAngle,
194  const DtVector& testPoint);
195 
196 DT_DLL_vrfutil DtFloat64 DtFastDist(const DtVector& pt1, const DtVector& pt2);
197 
199 DT_DLL_vrfutil void DtVecLimit(DtVectorRef vec,
200  double limit);
201 
202 inline double DtVecMag(const DtVector& vec)
203 {
204  return sqrt(vec[DtX]*vec[DtX] + vec[DtY]*vec[DtY] + vec[DtZ]*vec[DtZ]);
205 };
206 
207 inline double DtVecMagSquared(const DtVector& vec)
208 {
209  return vec[DtX]*vec[DtX] + vec[DtY]*vec[DtY] + vec[DtZ]*vec[DtZ];
210 };
211 
212 DT_DLL_vrfutil void DtRotX(double angle, DtDcm& rotMat);
213 DT_DLL_vrfutil void DtRotY(double angle, DtDcm& rotMat);
214 DT_DLL_vrfutil void DtRotZ(double angle, DtDcm& rotMat);
215 DT_DLL_vrfutil void DtBodyToLocalRef_to_Euler(DtConstDcm body2ref, DtTaitBryan *e);
216 DT_DLL_vrfutil void DtEuler_to_BodyToLocalRef(const DtTaitBryan &euler, DtDcm& body2ref);
217 DT_DLL_vrfutil const DtDcm & enu2ned();
218 DT_DLL_vrfutil const DtDcm & ned2enu();
219 
220 DT_DLL_vrfutil void DtRotX2(double sinAng, double cosAng, DtDcm& rotMat);
221 DT_DLL_vrfutil void DtRotY2(double sinAng, double cosAng, DtDcm& rotMat);
222 DT_DLL_vrfutil void DtRotZ2(double sinAng, double cosAng, DtDcm& rotMat);
223 
226 DT_DLL_vrfutil void DtRotBodyX(double angle, DtDcm& rotMat);
227 DT_DLL_vrfutil void DtRotBodyY(double angle, DtDcm& rotMat);
228 DT_DLL_vrfutil void DtRotBodyZ(double angle, DtDcm& rotMat);
229 
231 {
232  public:
233  DtPoleFilterType(double freq);
234  void setPole(double freq);
235  void output(DtTaitBryan* input,
236  double dT,
237  DtTaitBryan* output);
238  void output(const DtVector& input,
239  double dT,
240  DtVectorRef output);
241  double output(double input,
242  double dT);
243 
244  double getPole() { return poleFreq; }
245  const DtVector& getPrevOutput() { return prevOutput; }
246 
247  private:
248  double poleFreq;
250 };
255 {
256  public:
257  DtNonLinearOutputType(double nonlinearity,
258  double gain = 1.0)
259  {
260  DtGain = gain;
261  DtExponent = nonlinearity+1.0;
262  }
263 
264  void DtSetGain(double gain) { DtGain = gain; }
265  void DtSetNonLinearity(double nonlinearity) { DtExponent = nonlinearity+1.0; }
266 
267  double DtGetGain() { return DtGain; }
268  double DtGetNonLinearity() { return DtExponent-1.0; }
269  double DtOutput(double input)
270  {
271  return DtSIGN(input) * DtGain * pow(fabs(input), DtExponent);
272  }
273 
274  private:
275  double DtGain;
276  double DtExponent;
277 
278 };
279 
280 DT_DLL_vrfutil void DtCircleVerts(double radius,
281  int npts,
282  double* xCoords,
283  double* yCoords);
284 
287 
288 
290 DT_DLL_vrfutil void DtSpacesToDashes(char* str);
291 
292 
297 DT_DLL_vrfutil char* DtGetFilenameExtension(char* fileName, char* extension);
298 
299 
306 // y is left
307 // z is up
310 // Y is forward
311 // z is up
312 
314  const DtVector& rightPoint,
315  const DtVector& rearPoint,
316  DtDcm& orientation,
317  bool yIsForward=false);
318 
321  const DtVector& rightPoint,
322  const DtVector& otherPoint,
323  double cosHeading,
324  double sinHeading,
325  DtDcm& orientation,
326  bool upsideDown = false);
327 
330  const DtVector& rightPoint, const DtVector& otherPoint, double heading,
331  const DtDcm& topoToLocal, DtDcm& orientation);
332 
333 
337 DT_DLL_vrfutil bool DtCalculateNormal(const DtVector& pointA,
338  const DtVector& pointB, const DtVector& pointC, DtVector& normal);
339 
340 
343 DT_DLL_vrfutil void DtCalculateOrientation(DtVector localNormal, double heading,
344  const DtDcm& topoToLocal, DtDcm& localOrientation);
345 
346 
347 DT_DLL_vrfutil double DtFindZInPlane(const double posx, const double posy,
348  const DtVector& pointInPlane, const DtVector& normal);
349 
354 DT_DLL_vrfutil DtVector DtIntersectLineWithPlane(const DtVector& point, const DtVector& direction,
355  const DtVector& pointInPlane, const DtVector& planeNormal,
356  bool* noIntersection = 0);
357 
362  const DtChord& chord, const DtVector& lower, const DtVector& upper,
363  DtVrfChordIntersectRecordList* intList = 0);
364 
368  const DtChord& chord,
369  const DtVector& p1, const DtVector& p2, const DtVector& p3,
370  DtVector* result = 0, double* t = 0);
371 
374  double x1, double y1, double x2, double y2,
375  double z11, double z21, double z12, double z22,
376  double x, double y);
377 
381  const DtChord& chord,
382  double x1, double y1, double x2, double y2,
383  double z11, double z21, double z12, double z22,
386  double tolerance = 1e-20);
387 
391  double heading, const DtVector& position, DtDcm& bodyToRef);
392 
398 DT_DLL_vrfutil void DtTopoEulerToBodyToLocal(const DtTaitBryan& topoEuler,
399  const Coordinate_System& coordSystem, const DtVector& localPosition,
400  DtDcm& bodyToLocalDcm);
401 
402 DT_DLL_vrfutil DtDcm DtRotZToBodyToLocal(const Coordinate_System& coordSystem, double angle,
403  const DtVector& position);
404 DT_DLL_vrfutil DtDcm DtRotYToBodyToLocal(const Coordinate_System& coordSystem, double angle,
405  const DtVector& position);
406 DT_DLL_vrfutil DtDcm DtRotXToBodyToLocal(const Coordinate_System& coordSystem, double angle,
407  const DtVector& position);
408 
411 DT_DLL_vrfutil double DtHeadingFromGeocAToGeocB(const DtVector& geocA, const DtVector& geocB);
412 
416 
417 
419 
420 DT_DLL_vrfutil double DtSin(double r);
421 
422 inline double DtCos(double r)
423 {
424  return DtSin(r + DtPI_OVER_TWO);
425 }
426 
427 inline double DtTan(double r)
428 {
429  double cosR = DtCos(r);
430 
431  if (DtIsZero<double>(cosR))
432  {
433  errno = EDOM;
434  return 0.;
435  }
436 
437  else
438  {
439  return DtSin(r) / cosR;
440  }
441 }
442 
443 DT_DLL_vrfutil double DtAsin(double x);
444 
445 inline double DtAcos(double x)
446 {
447  return DtPI_OVER_TWO + DtAsin(-x);
448 }
449 
450 DT_DLL_vrfutil double DtAtan(double x);
451 DT_DLL_vrfutil double DtAtan2(double y, double x);
452 
453 DT_DLL_vrfutil bool DtSameSign(double x, double y);
454 
455 DT_DLL_vrfutil bool DtPointInSegment(const DtVector& testPoint, const DtVector& segStart,
456  const DtVector& segEnd);
457 
458 /*******************************************************************************
464  *******************************************************************************/
465 
483  DtVector Q1, DtVector* I0 = 0, DtVector* I1 = 0,
484  double* isectParam1 = 0, double *isectParam2 = 0,
485  bool* parallel = 0, bool* collinear = 0);
486 
494 
498 
502  const Coordinate_System& coordinateSystem);
503 
506 
507 DT_DLL_vrfutil double altitudeOfPosition(const DtVector& localPosition,
508  const Coordinate_System& coordinateSystem);
509 DT_DLL_vrfutil double altitudeOfPosition(const DtPoint& localPosition,
510  const Coordinate_System& coordinateSystem);
512 
515 
516 DT_DLL_vrfutil void setAltitudeOfPosition(DtVector& localPosition, double newAltitude,
517  const Coordinate_System& coordinateSystem);
518 DT_DLL_vrfutil void setAltitudeOfPosition(DtPoint& localPosition, double newAltitude,
519  const Coordinate_System& coordinateSystem);
521 
522 
528 
531 DT_DLL_vrfutil double headingAngleTo(const DtVector& observerPosition,
532  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
533 
536 DT_DLL_vrfutil double elevationAngleTo(const DtVector& observerPosition,
537  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
538 
541 DT_DLL_vrfutil double bankAngleTo(const DtVector& observerPosition,
542  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
543 
546 DT_DLL_vrfutil double distSquaredTo2D(const DtVector& position1, const DtVector& position2,
547  const Coordinate_System& coordinateSystem);
548 
554 DT_DLL_vrfutil bool inside(const DtVector& localPoint,
555  const DtLocalVertexList& localVertexList,
556  const Coordinate_System& coordinateSystem);
557 
558 DT_DLL_vrfutil bool insideEllipsoid(const DtVector& localPoint,
559  const DtLocalVertexList& localVertexList,
560  const Coordinate_System& coordinateSystem);
561 
562 
568 DT_DLL_vrfutil bool leftOf(const DtVector& localPoint,
569  const DtLocalVertexList& localVertexList,
570  const Coordinate_System& coordinateSystem);
571 
577 DT_DLL_vrfutil double headingAngleTo(const DtVector& localPoint,
578  const DtLocalVertexList& localVertexList,
579  const Coordinate_System& coordinateSystem);
580 
585 DT_DLL_vrfutil double elevationAngleTo(const DtVector& localPoint,
586  const DtLocalVertexList& localVertexList,
587  const Coordinate_System& coordinateSystem);
588 
595 DT_DLL_vrfutil double localDistSquaredTo(const DtVector& localPoint,
596  const DtLocalVertexList& localVertexList,
597  const Coordinate_System& coordinateSystem);
598 
603 DT_DLL_vrfutil double distSquaredTo2D(const DtVector& localPoint,
604  const DtLocalVertexList& localVertexList,
605  const Coordinate_System& coordinateSystem);
606 
616 DT_DLL_vrfutil double distToBoundingVolume(const DtVector& localBaseLocation,
617  const Dt3dBoundingVolume* box, const DtTaitBryan& boxToLocalOrientation,
618  const DtVector& testPoint);
619 
625 DT_DLL_vrfutil bool intersects(const DtVector& localPoint1,
626  const DtVector& localPoint2, const DtLocalVertexList& localVertexList,
627  const Coordinate_System& coordinateSystem);
628 
631 DT_DLL_vrfutil DtListItem* getClosestVertex2D(const DtVector& localPoint,
632  const DtLocalVertexList& localVertexList,
633  const Coordinate_System& coordinateSystem);
634 
638 DT_DLL_vrfutil bool getClosestLine2D(const DtVector& localPoint,
639  DtVector& localLinePt1, DtVector& localLinePt2,
640  const DtLocalVertexList& localVertexList,
641  const Coordinate_System& coordinateSystem);
642 
647 DT_DLL_vrfutil double distanceSquaredPointToLine2D(const DtVector& localPoint,
648  const DtVector& localLinePt1, const DtVector& localLinePt2,
649  const Coordinate_System& coordinateSystem);
650 
654  const DtVector& topoLinePt1, const DtVector & topoLinePoint2);
655 
659 DT_DLL_vrfutil double distanceSquaredPointToPoint2D(const DtVector& localLinePt1,
660  const DtVector& localLinePt2, const Coordinate_System& coordinateSystem);
661 
667 DT_DLL_vrfutil double closestPointAlongChord2D( const DtPoint& chordStart,
668  const DtPoint& chordEnd,
669  const DtPoint& testPoint, DtPoint & closestPoint,
670  const Coordinate_System& coordSys);
671 
685  const DtVector& point, const Coordinate_System& coordinateSystem,
686  DtLocalVectorIterator& localVertexIterator);
687 
696 
697 inline double dotProd2D(const DtVector& v1, const DtVector& v2)
698 {
699  return v1[0]*v2[0] + v1[1]*v2[1];
700 }
701 
702 inline double magnitudeSquared2D(const DtVector &v)
703 {
704  return dotProd2D(v, v);
705 }
706 
707 inline double crossProduct2D(const DtVector& v1, const DtVector& v2)
708 {
709  return v1[0]*v2[1] - v1[1]*v2[0];
710 }
711 
713 {
714  DtVector res(v[1], -v[0], v[2]);
715  return res;
716 }
717 
718 inline void normalize2D(DtVector& v)
719 {
720  double length = sqrt(magnitudeSquared2D(v));
721  if (length > 0.0)
722  {
723  v[0] /= length;
724  v[1] /= length;
725  }
726 }
727 
729 inline double vectorAngle2D(DtVector& v)
730 {
731  return DtModPerLo(atan2(v[1], v[0]), -M_PI, M_PI);
732 }
736 
748 DT_DLL_vrfutil void localVectorToGeocentricVector(const DtVector &geocentricPosition,
749  const DtVector& localVector, const Coordinate_System& coordinateSystem,
750  DtVector& geocentricVector);
751 
764  const DtTaitBryan& localOrientation,
765  const Coordinate_System& coordinateSystem,
766  DtTaitBryan& geocentricOrientation);
767 
772  const DtDcm& newOrientation,
773  const DtDcm& oldOrientation, double dT);
774 
777 DT_DLL_vrfutil double calculateSpeedForArrival(double distance, double currentSpeed, double acceleration,
778  double deceleration, double timeToArrive);
779 
790 DT_DLL_vrfutil void geocentricVectorToLocalVector(const DtVector &geocentricPosition,
791  const DtVector& geocentricVector, const Coordinate_System& coordinateSystem,
792  DtVector& localVector);
793 
806  const DtVector& geocentricPosition,
807  const DtTaitBryan& geocentricOrientation,
808  const Coordinate_System& coordinateSystem,
809  DtTaitBryan& localOrientation);
810 
812 DT_DLL_vrfutil int DtIntRandom(int iFrom, int iTo);
813 
815 DT_DLL_vrfutil bool DtIsValidNumber(double x);
816 
819 DT_DLL_vrfutil double DtHoursMinutesSeconds2Seconds(double hours, double minutes, double seconds);
820 
822 DT_DLL_vrfutil void DtSeconds2HoursMinutesSeconds(double totalSeconds, int& hoursOut,
823  int& minutesOut, double& secondsOut);
824 
826 DT_DLL_vrfutil double calculateLengthOfLine(const std::vector<DtVector>& points);
827 
830 DT_DLL_vrfutil double calculateLengthOfLine(const Coordinate_System& coordinateSystem, const std::vector<DtVector>& points);
831 
834 DT_DLL_vrfutil void calculateLengthAndWidthOfShape(const Coordinate_System& coordSytem, const std::vector<DtVector>& points,
835  double& length, double& width);
836 
838 DT_DLL_vrfutil void calculateLengthAndWidthOfShape(const std::vector<DtVector>& points,
839  double& length, double& width);
840 
843 
849  const DtVector & currentLocalPos, const DtVector & localVelocity,
850  const Coordinate_System& coordinateSystem);
851 
863 DT_DLL_vrfutil double illuminationValueAtPosition(const DtGeodeticCoord& position, time_t time,
864  double nighttimeMaximum = 0.1, double illuminationMinimum = 0.001, bool useDayNightIlluminationModel = true,
865  int* sunstate = 0);
866 
873 DT_DLL_vrfutil bool calculateEstimatedTot(const DtVector& localCurrentPos, const DtVector& localTargetPos,
874  double orderedSpeed, double currentSimTime, double currentSpeed, double acceleration,
875  const Coordinate_System& coordinateSystem, double& totResult, double& speedResult);
876 
883 DT_DLL_vrfutil bool calculateEstimatedTot(const DtVector& localCurrentPos, const DtLocalVertexList& localVertexList,
884  double orderedSpeed, double currentSimTime, double currentSpeed, double acceleration,
885  const Coordinate_System& coordinateSystem, double& totResult, double& speedResult);
886 
888 inline bool checkForNAN(const DtVector& vector)
889 {
890  if (boost::math::isnan(vector.x()) ||
891  boost::math::isnan(vector.y()) ||
892  boost::math::isnan(vector.z()))
893  {
894  return true;
895  }
896  else
897  {
898  return false;
899  }
900 }
901 
903 inline bool checkForNAN(const DtTaitBryan& tb)
904 {
905  if (boost::math::isnan(tb.phi()) ||
906  boost::math::isnan(tb.psi()) ||
907  boost::math::isnan(tb.theta()))
908  {
909  return true;
910  }
911  else
912  {
913  return false;
914  }
915 }
916 
918 inline bool checkForNAN(const DtDcm& dcm)
919 {
920  if (boost::math::isnan(dcm[0].x()) ||
921  boost::math::isnan(dcm[0].y()) ||
922  boost::math::isnan(dcm[0].z()) ||
923  boost::math::isnan(dcm[1].x()) ||
924  boost::math::isnan(dcm[1].y()) ||
925  boost::math::isnan(dcm[1].z()) ||
926  boost::math::isnan(dcm[2].x()) ||
927  boost::math::isnan(dcm[2].y()) ||
928  boost::math::isnan(dcm[2].z()))
929  {
930  return true;
931  }
932  else
933  {
934  return false;
935  }
936 }
937 
939 DT_DLL_vrfutil std::map<std::string, std::string> convertToStdStringMap(const std::map<DtString, DtString>& source,
940  bool convertValueForXml = false);
941 
944 
945 #include <boost/algorithm/string.hpp>
946 template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
947 inline SequenceSequenceT& oldBoostSplit(
948  SequenceSequenceT& Result,
949  RangeT& Input,
950  PredicateT Pred,
951  boost::algorithm::token_compress_mode_type eCompress=boost::algorithm::token_compress_off )
952 {
953  if (Input.length())
954  {
955  ::boost::algorithm::iter_split(
956  Result,
957  Input,
958  ::boost::algorithm::token_finder( Pred, eCompress ) );
959  }
960 
961  return Result;
962 }
963 
973 DT_DLL_vrfutil bool isPointWithinCorridor(double& heading, double corridorWidth,
974  double corridorHeight, const DtVector& localPoint, const DtLocalVertexList& localVertexList,
975  const Coordinate_System& coordinateSystemRef);
976 
984 DT_DLL_vrfutil bool isChordWithinCorridor(const DtChord& localChord, const DtLocalVertexList& localVertexList,
985  double corridorWidth, double corridorHeight, const Coordinate_System& coordinateSystemRef);
986 
994 DT_DLL_vrfutil bool isPointRoughlyWithinCorridor(double corridorWidth,
995  double corridorHeight, const DtVector& localPoint, const DtExtent & lineExtent,
996  const Coordinate_System& coordinateSystemRef);
997 
1005 DT_DLL_vrfutil bool isChordRoughlyWithinCorridor(const DtChord& localChord, const DtExtent& lineExtent,
1006  double corridorWidth, double corridorHeight, const Coordinate_System& coordinateSystemRef);
1007 
1012 DT_DLL_vrfutil double getHeadingFromGeocentric(const DtVector& firstPoint, const DtVector& secondPoint);
DT_DLL_vrfutil void DtParallelAxisTheorem(DtConstDcm inertiaInOriginalFrame, double mass, const DtVector &newToOriginal, DtDcm &inertiaInNewFrame)
double DtVecMag(const DtVector &vec)
Definition: kinematicTools.h:202
DT_DLL_vrfutil char * DtGetFilenameExtension(char *fileName, char *extension)
Extract the extension from the fileName, excluding the period(.).
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
double DtGetGain()
Definition: kinematicTools.h:267
#define DtSIGN(x)
Boost includes.
Definition: kinematicTools.h:25
DT_DLL_vrfutil bool isChordWithinCorridor(const DtChord &localChord, const DtLocalVertexList &localVertexList, double corridorWidth, double corridorHeight, const Coordinate_System &coordinateSystemRef)
This function determines whether a given chord intersects with the volume defined by the corridor...
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords.
Definition: vrfChordIntersectRecordList.h:31
double DtOutput(double input)
Definition: kinematicTools.h:269
DT_DLL_vrfutil void DtResolve(const DtVector &forcePos, const DtVector &force, DtVectorRef resultTorqueAboutOrigin)
DT_DLL_vrfutil bool DtIsValidNumber(double x)
Returns true if the number is not infinite or not nan.
DT_DLL_vrfutil void localOrientationToGeocentricOrientation(const DtVector geocentricPosition, const DtTaitBryan &localOrientation, const Coordinate_System &coordinateSystem, DtTaitBryan &geocentricOrientation)
Transforms an orientation matrix in for going from body to local coordinates (database coordinates) t...
DT_DLL_vrfutil double illuminationValueAtPosition(const DtGeodeticCoord &position, time_t time, double nighttimeMaximum=0.1, double illuminationMinimum=0.001, bool useDayNightIlluminationModel=true, int *sunstate=0)
Give a geodetic coordinate and a UTC time, return an illumination value (0 - 1) at that position base...
DT_DLL_vrfutil const DtDcm & ned2enu()
DT_DLL_vrfutil double getHeadingFromGeocentric(const DtVector &firstPoint, const DtVector &secondPoint)
This function returns the heading of an object with two points in geocentric Basically this is used t...
DT_DLL_vrfutil double distToBoundingVolume(const DtVector &localBaseLocation, const Dt3dBoundingVolume *box, const DtTaitBryan &boxToLocalOrientation, const DtVector &testPoint)
Returns the distance of the testPoint to the bounding volume.
#define DtPI_OVER_TWO
Definition: kinematicTools.h:30
DT_DLL_vrfutil bool setCurrentVertexToClosestInDirectionOfTraversal(const DtVector &point, const Coordinate_System &coordinateSystem, DtLocalVectorIterator &localVertexIterator)
Sets current vertex in localVertexIterator to that vertex closest to the given point, in the direction of travel.
double DtVecMagSquared(const DtVector &vec)
Definition: kinematicTools.h:207
DT_DLL_vrfutil void DtRotateInertia(DtDcm inertiaInOriginalFrame, DtDcm originalToNew, DtDcm &inertiaInNewFrame)
I in frame B.
DT_DLL_vrfutil double DtAsin(double x)
DT_DLL_vrfutil DtListItem * getClosestVertex2D(const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Sets vertex to be the vertex closest in 2D to point in localVertexList.
double vectorAngle2D(DtVector &v)
This is a heading if v is in topo coordinates.
Definition: kinematicTools.h:729
DT_DLL_vrfutil void setAltitudeOfPosition(DtVector &localPosition, double newAltitude, const Coordinate_System &coordinateSystem)
Alters localPosition to have the specified altitude (above 0 altitude).
DT_DLL_vrfutil void DtRotZ2(double sinAng, double cosAng, DtDcm &rotMat)
DT_DLL_vrfutil void DtRotBodyZ(double angle, DtDcm &rotMat)
DT_DLL_vrfutil bool DtInSegment(DtVector P, DtVector P0, DtVector P1)
DtInSegment(): determine if a collinear Point P is inside a Segment P0 to P1.
DT_DLL_vrfutil void DtRotX2(double sinAng, double cosAng, DtDcm &rotMat)
DT_DLL_vrfutil double altitudeOfPosition(const DtVector &localPosition, const Coordinate_System &coordinateSystem)
DT_DLL_vrfutil void DtRotY2(double sinAng, double cosAng, DtDcm &rotMat)
double poleFreq
Definition: kinematicTools.h:248
File: lclVecIter.h.
Definition: localVectorIterator.h:25
DT_DLL_vrfutil DtPoint DtVector2DtPoint(const DtVector &p)
DtVector rotateRight2D(const DtVector &v)
Definition: kinematicTools.h:712
DT_DLL_vrfutil double DtSin(double r)
DT_DLL_vrfutil double maxAccelerationFromConstraint(const double deceleration, const double dt, const double ownSpeed, const double distance, const double targetSpeed, const double errorDecelValue=-1e10)
This function computes the maximum acceleration that an entity can use during the next tick and still...
DT_DLL_vrfutil double gRand()
Generates a Gaussian random number.
DT_DLL_vrfutil bool DtPointInSegment(const DtVector &testPoint, const DtVector &segStart, const DtVector &segEnd)
DT_DLL_vrfutil double DtPIDServo(double error, double errorIntegral, double velocity, double proportionalGain, double integralGain, double derivativeGain, double biasForce=0.0, double *control=0)
I in frame B.
DT_DLL_vrfutil const DtDcm & enu2ned()
DT_DLL_vrfutil bool insideEllipsoid(const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
DT_DLL_vrfutil double DtFindZInPlane(const double posx, const double posy, const DtVector &pointInPlane, const DtVector &normal)
DT_DLL_vrfutil unsigned int DtIntersectChordWithBilinearSurface(const DtChord &chord, double x1, double y1, double x2, double y2, double z11, double z21, double z12, double z22, DtVrfChordIntersectionRecord &isect1, DtVrfChordIntersectionRecord &isect2, double tolerance=1e-20)
Find intersection between bilinear interpolated surface and line.
DT_DLL_vrfutil double headingAngleTo(const DtVector &observerPosition, const DtVector &targetPosition, const Coordinate_System &coordinateSystem)
Local(database) functions for performing topocentric 2-D geometry operations on points and vertex li...
DT_DLL_vrfutil DtDcm DtRotYToBodyToLocal(const Coordinate_System &coordSystem, double angle, const DtVector &position)
DT_DLL_vrfutil double centralLimitGaussian(int numDraws)
Generates a Gaussian random number (an approximation), from a series of n uniform random number draws...
DT_DLL_vrfutil double DtBilinearInterpolate(double x1, double y1, double x2, double y2, double z11, double z21, double z12, double z22, double x, double y)
Returns result of bilinear interpolation on grid defined by (x1,y1) to (x1,y2) at point (x...
double DtExponent
Definition: kinematicTools.h:276
A nonlinearity of zero gives you a simple linear relation: output = gain * input. ...
Definition: kinematicTools.h:254
DT_DLL_vrfutil DtVector localGravityAcceleration(const DtVector &localPosition, const Coordinate_System &coordinateSystem)
Terrain related functions.
const DtVector & getPrevOutput()
Definition: kinematicTools.h:245
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
DT_DLL_vrfutil bool leftOf(const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Returns true if localPoint is left of the localVertexList in 2D.
DT_DLL_vrfutil bool DtChordIntersectsExtentArea(const DtChord &chord, const DtVector &lower, const DtVector &upper, DtVrfChordIntersectRecordList *intList=0)
Returns true if the chord intersects the extent area (i.e.
DT_DLL_vrfutil void Dt3DDynamicsTick(const DtVector &LinearForce, double vehicleMass, DtVectorRef newLinearAcceleration, const DtVector &torque, DtConstDcm vehicleInertia, DtVectorRef newAngAcceleration)
DT_DLL_vrfutil void DtRotBodyX(double angle, DtDcm &rotMat)
Returns a matrix for converting from the new system to the old system where both systems are using bo...
DT_DLL_vrfutil DtVector DtPoint2DtVector(const DtPoint &p)
DT_DLL_vrfutil double calculateLengthOfLine(const std::vector< DtVector > &points)
Given the points return the length of the line. Assumes points are geocentric.
DT_DLL_vrfutil double distanceSquaredPointToPoint2D(const DtVector &localLinePt1, const DtVector &localLinePt2, const Coordinate_System &coordinateSystem)
Returns the distance^2 from point1 to point2 in 2D.
double DtGain
Definition: kinematicTools.h:275
DT_DLL_vrfutil int DtIntersect2D_Segments(DtVector P0, DtVector P1, DtVector Q0, DtVector Q1, DtVector *I0=0, DtVector *I1=0, double *isectParam1=0, double *isectParam2=0, bool *parallel=0, bool *collinear=0)
Description:
DT_DLL_vrfutil bool calculateEstimatedTot(const DtVector &localCurrentPos, const DtVector &localTargetPos, double orderedSpeed, double currentSimTime, double currentSpeed, double acceleration, const Coordinate_System &coordinateSystem, double &totResult, double &speedResult)
Returns the estimated time-on-target to a local target position, given local current position...
DT_DLL_vrfutil double elevationAngleTo(const DtVector &observerPosition, const DtVector &targetPosition, const Coordinate_System &coordinateSystem)
Returns the elevation angle in radians from observer position to target position. ...
DT_DLL_vrfutil void DtTrigInit()
Functions for trig table lookups.
DT_DLL_vrfutil double DtHeadingFromGeocAToGeocB(const DtVector &geocA, const DtVector &geocB)
Expects geocentric coordinates.
DT_DLL_vrfutil double DtAtan(double x)
double DtCos(double r)
Definition: kinematicTools.h:422
DT_DLL_vrfutil bool inside(const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Returns true if localPoint is inside localVertexList in 2D.
DT_DLL_vrfutil void DtRotBodyY(double angle, DtDcm &rotMat)
DT_DLL_vrfutil bool DtIntersectChordWithTriangle(const DtChord &chord, const DtVector &p1, const DtVector &p2, const DtVector &p3, DtVector *result=0, double *t=0)
Returns the point of intersection between a chord and a triangle.
DtVector prevOutput
Definition: kinematicTools.h:249
DT_DLL_vrfutil bool isPointWithinCorridor(double &heading, double corridorWidth, double corridorHeight, const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystemRef)
This function determines whether a given point is within a corridor and if so it populates the headin...
DT_DLL_vrfutil void DtRotY(double angle, DtDcm &rotMat)
DT_DLL_vrfutil DtVector DtCalculateRotationalVelocity(const DtDcm &newOrientation, const DtDcm &oldOrientation, double dT)
Calculates rotational velocity from new and old orientation body DCMs.
Definition: coordSystem.h:54
DT_DLL_vrfutil double distanceSquaredPointToLine2D(const DtVector &localPoint, const DtVector &localLinePt1, const DtVector &localLinePt2, const Coordinate_System &coordinateSystem)
Returns the distance^2 from point to linePt1-linePt2 in topographic 2D.
void DtSetGain(double gain)
Definition: kinematicTools.h:264
DT_DLL_vrfutil void DtBlockInertia(const double xLen, const double yLen, const double zLen, const double mass, DtDcm &inertia)
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
bool DtIsZero< double >(double input)
Definition: mathUtilities.h:100
DT_DLL_vrfutil double angle(double vec1[3], double vec2[3])
Definition: localVector.h:25
DT_DLL_vrfutil void DtVecLimit(DtVectorRef vec, double limit)
If mag(vec)&gt;limit, shortens vector to mag = limit.
DT_DLL_vrfutil void localVectorToGeocentricVector(const DtVector &geocentricPosition, const DtVector &localVector, const Coordinate_System &coordinateSystem, DtVector &geocentricVector)
local(database)/geocentric conversion functions
DT_DLL_vrfutil void DtBodyToRefFromHeadingAndPosition(const Coordinate_System &coordSystem, double heading, const DtVector &position, DtDcm &bodyToRef)
Calculates a Dcm for rotating from a body coordinate system, defined by a given heading (no pitch or ...
DT_DLL_vrfutil void geocentricOrientationToLocalOrientation(const DtVector &geocentricPosition, const DtTaitBryan &geocentricOrientation, const Coordinate_System &coordinateSystem, DtTaitBryan &localOrientation)
Transforms an orientation matrix in for going from body to local coordinates (database coordinates) t...
DT_DLL_vrfutil double closestPointAlongChord2D(const DtPoint &chordStart, const DtPoint &chordEnd, const DtPoint &testPoint, DtPoint &closestPoint, const Coordinate_System &coordSys)
Finds the closest point along the chord defined by chordStart and chordEnd to testPoint.
DT_DLL_vrfutil DtVector DtIntersectLineWithPlane(const DtVector &point, const DtVector &direction, const DtVector &pointInPlane, const DtVector &planeNormal, bool *noIntersection=0)
Returns the point of intersection between a line (defined by a point and a direction vector) and a pl...
DT_DLL_vrfutil double maxAccelerationFromInterceptConstraint(const double deceleration, const double dt, const double ownSpeed, const double distance, const double targetSpeed, const double errorDecelValue=-1e10)
This function is like maxAccelerationFromConstraint, but it assumes that the goal is to intercept a t...
DT_DLL_vrfutil void DtSeconds2HoursMinutesSeconds(double totalSeconds, int &hoursOut, int &minutesOut, double &secondsOut)
Converts totalSeconds into hours, minutes, and seconds.
double dotProd2D(const DtVector &v1, const DtVector &v2)
2D functions on 3D topographic objects
Definition: kinematicTools.h:697
double DtFloat64
Definition: vrvControlStructTypes.h:36
DT_DLL_vrfutil void DtEuler_to_BodyToLocalRef(const DtTaitBryan &euler, DtDcm &body2ref)
bool checkForNAN(const DtVector &vector)
Checks for not a number (NAN) values.
Definition: kinematicTools.h:888
double DtAcos(double x)
Definition: kinematicTools.h:445
DT_DLL_vrfutil double calculateSpeedForArrival(double distance, double currentSpeed, double acceleration, double deceleration, double timeToArrive)
Given a distance, current speed, max acceleration, max deceleration, and desired arrival time...
DT_DLL_vrfutil DtDcm DtRotZToBodyToLocal(const Coordinate_System &coordSystem, double angle, const DtVector &position)
void normalize2D(DtVector &v)
Definition: kinematicTools.h:718
DT_DLL_vrfutil double gaussianRandom()
Generates a Gaussian random number using the Marsaglia polar method.
const char * source
Definition: lz4.h:442
DT_DLL_vrfutil int DtIntRandom(int iFrom, int iTo)
Returns a random number from the base to the max.
double crossProduct2D(const DtVector &v1, const DtVector &v2)
Definition: kinematicTools.h:707
DT_DLL_vrfutil void Dt3DKinematicsTick(const DtVector &Position, const DtVector &LinearVelocity, const DtVector &LinearAcceleration, DtConstDcm orientation, const DtVector &angVelocity, const DtVector &angAcceleration, double DeltaTime, DtVectorRef newPosition, DtVectorRef newVelocity, DtDcm &newOrientation, DtVectorRef newAngVelocity)
Definition: asyncJobServer.h:39
DT_DLL_vrfutil void DtOrientationFromThreePointsAndHeading(const DtVector &leftPoint, const DtVector &rightPoint, const DtVector &otherPoint, double cosHeading, double sinHeading, DtDcm &orientation, bool upsideDown=false)
This form preserves heading; the previous one does not!
DT_DLL_vrfutil void DtRotZ(double angle, DtDcm &rotMat)
DT_DLL_vrfutil void DtBodyToLocalRef_to_Euler(DtConstDcm body2ref, DtTaitBryan *e)
DT_DLL_vrfutil double DtHoursMinutesSeconds2Seconds(double hours, double minutes, double seconds)
DT_DLL_vrfutil std::map< std::string, std::string > convertToStdStringMap(const std::map< DtString, DtString > &source, bool convertValueForXml=false)
Converts DtString to std::string map.
DT_DLL_vrfutil bool DtSameSign(double x, double y)
DT_DLL_vrfutil void DtDcmFromRows(DtDcm &result, const DtVector &row1, const DtVector &row2, const DtVector &row3)
DT_DLL_vrfutil void DtGravityForce(double mass, DtVectorRef returnForce)
DT_DLL_vrfutil DtFloat64 DtFastDist(const DtVector &pt1, const DtVector &pt2)
DT_DLL_vrfutil void DtCalculateOrientation(DtVector localNormal, double heading, const DtDcm &topoToLocal, DtDcm &localOrientation)
Calculates the orientation from the specified local normal and heading.
Definition: vrfChordIntersectionRecord.h:19
double DtTan(double r)
Definition: kinematicTools.h:427
double magnitudeSquared2D(const DtVector &v)
Definition: kinematicTools.h:702
DT_DLL_vrfutil void DtSpacesToDashes(char *str)
Inline versions of some functions in LibMatrix.
DT_DLL_vrfutil double distanceSquaredPointToLineTopographic(const DtVector &topoPoint, const DtVector &topoLinePt1, const DtVector &topoLinePoint2)
Same as distanceSquaredPointToLine2D, except that the points are assumed to be in topographic coordin...
double DtGetNonLinearity()
Definition: kinematicTools.h:268
DT_DLL_vrfutil double bankAngleTo(const DtVector &observerPosition, const DtVector &targetPosition, const Coordinate_System &coordinateSystem)
Returns the bank angle in radians from observer position to target position.
DT_DLL_vrfutil bool getClosestLine2D(const DtVector &localPoint, DtVector &localLinePt1, DtVector &localLinePt2, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Sets linePt1 and linePt2 to be the vertices of the line segment closest in 2D to point in localVertex...
DT_DLL_vrfutil bool isPointRoughlyWithinCorridor(double corridorWidth, double corridorHeight, const DtVector &localPoint, const DtExtent &lineExtent, const Coordinate_System &coordinateSystemRef)
This function roughly determines whether a point may be within a corridor.
SequenceSequenceT & oldBoostSplit(SequenceSequenceT &Result, RangeT &Input, PredicateT Pred, boost::algorithm::token_compress_mode_type eCompress=boost::algorithm::token_compress_off)
Replace boost split with version that returns an empty set if the supplied string has no length...
Definition: kinematicTools.h:947
DT_DLL_vrfutil void geocentricVectorToLocalVector(const DtVector &geocentricPosition, const DtVector &geocentricVector, const Coordinate_System &coordinateSystem, DtVector &localVector)
Transforms a vector in geocentric coordinates to local (database) coordinates.
DT_DLL_vrfutil bool DtCalculateNormal(const DtVector &pointA, const DtVector &pointB, const DtVector &pointC, DtVector &normal)
Calculates the normal formed by the plane containing points A, B, and C.
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
DT_DLL_vrfutil double DtAtan2(double y, double x)
DT_DLL_vrfutil void DtDcmFromColumns(DtDcm &result, const DtVector &col1, const DtVector &col2, const DtVector &col3)
DT_DLL_vrfutil bool isChordRoughlyWithinCorridor(const DtChord &localChord, const DtExtent &lineExtent, double corridorWidth, double corridorHeight, const Coordinate_System &coordinateSystemRef)
This function determines whether a given chord roughly intersects with the volume defined by the corr...
DT_DLL_vrfutil bool DtPointInCone(const DtVector &coneEndPosition, const DtVector &coneAxis, const double coneAngle, const DtVector &testPoint, double *testAnglePtr=0)
Test if a point is in a cone.
DtNonLinearOutputType(double nonlinearity, double gain=1.0)
Definition: kinematicTools.h:257
DT_DLL_vrfutil bool intersects(const DtVector &localPoint1, const DtVector &localPoint2, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Returns true if the line segment localPoint1-localPoint2 intersects.
DT_DLL_vrfutil double localDistSquaredTo(const DtVector &localPoint, const DtLocalVertexList &localVertexList, const Coordinate_System &coordinateSystem)
Returns the distance from localPoint to the closest vertex in localVertexList.
DT_DLL_vrfutil bool DtPointInWedge(const DtVector &wedgeEndPosition, const DtVector &wedgeAxis, const double wedgeAngle, const DtVector &testPoint)
DT_DLL_vrfutil DtVector calculateWorldVelocityFromPosition(const DtVector &currentWorldPos, const DtVector &currentLocalPos, const DtVector &localVelocity, const Coordinate_System &coordinateSystem)
If the database is in a projected system, error is introduced in the velocity when converting it to g...
DT_DLL_vrfutil void calculateLengthAndWidthOfShape(const Coordinate_System &coordSytem, const std::vector< DtVector > &points, double &length, double &width)
Given points and the coordinate system those points are in find the length/width of the given polygon...
Definition: kinematicTools.h:230
DT_DLL_vrfutil void DtRotX(double angle, DtDcm &rotMat)
double getPole()
Definition: kinematicTools.h:244
class DtLocalVertexList:
Definition: localVertexList.h:20
DT_DLL_vrfutil bool DtVectorIsZero(const DtVector &v, double tolerance=0.0)
void DtSetNonLinearity(double nonlinearity)
Definition: kinematicTools.h:265
DT_DLL_vrfutil void DtTopoEulerToBodyToLocal(const DtTaitBryan &topoEuler, const Coordinate_System &coordSystem, const DtVector &localPosition, DtDcm &bodyToLocalDcm)
Calculates the rotation matrix for going from a body to local (database) reference frame...
DT_DLL_vrfutil DtDcm DtRotXToBodyToLocal(const Coordinate_System &coordSystem, double angle, const DtVector &position)
Definition: point.h:34
DT_DLL_vrfutil void DtOrientationFromThreePoints(const DtVector &leftPoint, const DtVector &rightPoint, const DtVector &rearPoint, DtDcm &orientation, bool yIsForward=false)
Given the world position of the three big-wheel points, this returns the resulting orientation of big...
DT_DLL_vrfutil void DtCircleVerts(double radius, int npts, double *xCoords, double *yCoords)
DT_DLL_vrfutil double distSquaredTo2D(const DtVector &position1, const DtVector &position2, const Coordinate_System &coordinateSystem)
Returns the (2D) squared distance between given position.

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)