VR-Forces 4.8 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 DtLocalVector;
53 class DtLocalVertexList;
54 class DtListItem;
56 class DtPoint;
59 
60 #include "vrfutil/vrfutilDefines.h"
61 
64 DT_DLL_vrfutil double gRand();
65 
69 DT_DLL_vrfutil double centralLimitGaussian(int numDraws);
70 
76 
77 DT_DLL_vrfutil void Dt3DKinematicsTick(const DtVector& Position,
78  const DtVector& LinearVelocity,
79  const DtVector& LinearAcceleration,
80  DtConstDcm orientation,
81  const DtVector& angVelocity,
82  const DtVector& angAcceleration,
83  double DeltaTime,
84  DtVectorRef newPosition,
85  DtVectorRef newVelocity,
86  DtDcm& newOrientation,
87  DtVectorRef newAngVelocity);
88 
89 DT_DLL_vrfutil void Dt3DDynamicsTick(const DtVector& LinearForce,
90  double vehicleMass,
91  DtVectorRef newLinearAcceleration,
92  const DtVector& torque,
93  DtConstDcm vehicleInertia,
94  DtVectorRef newAngAcceleration);
95 
96 DT_DLL_vrfutil void DtGravityForce(double mass,
97  DtVectorRef returnForce);
98 
99 DT_DLL_vrfutil void DtResolve(const DtVector& forcePos,
100  const DtVector& force,
101  DtVectorRef resultTorqueAboutOrigin);
102 
103 DT_DLL_vrfutil void DtParallelAxisTheorem(DtConstDcm inertiaInOriginalFrame,
104  double mass,
105  const DtVector& newToOriginal,
106  DtDcm& inertiaInNewFrame);
107 
108 DT_DLL_vrfutil void DtRotateInertia(DtDcm inertiaInOriginalFrame,
109  DtDcm originalToNew,
110  DtDcm& inertiaInNewFrame);
111 
112 DT_DLL_vrfutil double DtPIDServo(double error,
113  double errorIntegral,
114  double velocity,
115  double proportionalGain,
116  double integralGain,
117  double derivativeGain,
118  double biasForce = 0.0,
119  double* control = 0);
120 
134  const double deceleration, const double dt, const double ownSpeed,
135  const double distance, const double targetSpeed, const double errorDecelValue = -1e10);
136 
150  const double deceleration, const double dt, const double ownSpeed,
151  const double distance, const double targetSpeed, const double errorDecelValue = -1e10);
152 
153 
154 DT_DLL_vrfutil void DtBlockInertia(const double xLen,
155  const double yLen,
156  const double zLen,
157  const double mass,
158  DtDcm& inertia);
159 
161  double tolerance = 0.0);
162 
163 DT_DLL_vrfutil void DtDcmFromColumns(DtDcm& result,
164  const DtVector& col1,
165  const DtVector& col2,
166  const DtVector& col3);
167 
168 DT_DLL_vrfutil void DtDcmFromRows(DtDcm& result,
169  const DtVector& row1,
170  const DtVector& row2,
171  const DtVector& row3);
172 
173 
174 
183 DT_DLL_vrfutil bool DtPointInCone(const DtVector& coneEndPosition,
184  const DtVector& coneAxis,
185  const double coneAngle,
186  const DtVector& testPoint,
187  double* testAnglePtr = 0);
188 
189 
190 DT_DLL_vrfutil bool DtPointInWedge(const DtVector& wedgeEndPosition,
191  const DtVector& wedgeAxis,
192  const double wedgeAngle,
193  const DtVector& testPoint);
194 
195 DT_DLL_vrfutil DtFloat64 DtFastDist(const DtVector& pt1, const DtVector& pt2);
196 
198 DT_DLL_vrfutil void DtVecLimit(DtVectorRef vec,
199  double limit);
200 
201 inline double DtVecMag(const DtVector& vec)
202 {
203  return sqrt(vec[DtX]*vec[DtX] + vec[DtY]*vec[DtY] + vec[DtZ]*vec[DtZ]);
204 };
205 
206 inline double DtVecMagSquared(const DtVector& vec)
207 {
208  return vec[DtX]*vec[DtX] + vec[DtY]*vec[DtY] + vec[DtZ]*vec[DtZ];
209 };
210 
211 DT_DLL_vrfutil void DtRotX(double angle, DtDcm& rotMat);
212 DT_DLL_vrfutil void DtRotY(double angle, DtDcm& rotMat);
213 DT_DLL_vrfutil void DtRotZ(double angle, DtDcm& rotMat);
214 DT_DLL_vrfutil void DtBodyToLocalRef_to_Euler(DtConstDcm body2ref, DtTaitBryan *e);
215 DT_DLL_vrfutil void DtEuler_to_BodyToLocalRef(const DtTaitBryan &euler, DtDcm& body2ref);
216 DT_DLL_vrfutil const DtDcm & enu2ned();
217 DT_DLL_vrfutil const DtDcm & ned2enu();
218 
219 DT_DLL_vrfutil void DtRotX2(double sinAng, double cosAng, DtDcm& rotMat);
220 DT_DLL_vrfutil void DtRotY2(double sinAng, double cosAng, DtDcm& rotMat);
221 DT_DLL_vrfutil void DtRotZ2(double sinAng, double cosAng, DtDcm& rotMat);
222 
225 DT_DLL_vrfutil void DtRotBodyX(double angle, DtDcm& rotMat);
226 DT_DLL_vrfutil void DtRotBodyY(double angle, DtDcm& rotMat);
227 DT_DLL_vrfutil void DtRotBodyZ(double angle, DtDcm& rotMat);
228 
230 {
231  public:
232  DtPoleFilterType(double freq);
233  void setPole(double freq);
234  void output(DtTaitBryan* input,
235  double dT,
236  DtTaitBryan* output);
237  void output(const DtVector& input,
238  double dT,
239  DtVectorRef output);
240  double output(double input,
241  double dT);
242 
243  double getPole() { return poleFreq; }
244  const DtVector& getPrevOutput() { return prevOutput; }
245 
246  private:
247  double poleFreq;
249 };
254 {
255  public:
256  DtNonLinearOutputType(double nonlinearity,
257  double gain = 1.0)
258  {
259  DtGain = gain;
260  DtExponent = nonlinearity+1.0;
261  }
262 
263  void DtSetGain(double gain) { DtGain = gain; }
264  void DtSetNonLinearity(double nonlinearity) { DtExponent = nonlinearity+1.0; }
265 
266  double DtGetGain() { return DtGain; }
267  double DtGetNonLinearity() { return DtExponent-1.0; }
268  double DtOutput(double input)
269  {
270  return DtSIGN(input) * DtGain * pow(fabs(input), DtExponent);
271  }
272 
273  private:
274  double DtGain;
275  double DtExponent;
276 
277 };
278 
279 DT_DLL_vrfutil void DtCircleVerts(double radius,
280  int npts,
281  double* xCoords,
282  double* yCoords);
283 
286 
287 
289 DT_DLL_vrfutil void DtSpacesToDashes(char* str);
290 
291 
296 DT_DLL_vrfutil char* DtGetFilenameExtension(char* fileName, char* extension);
297 
298 
305 // y is left
306 // z is up
309 // Y is forward
310 // z is up
311 
313  const DtVector& rightPoint,
314  const DtVector& rearPoint,
315  DtDcm& orientation,
316  bool yIsForward=false);
317 
320  const DtVector& rightPoint,
321  const DtVector& otherPoint,
322  double cosHeading,
323  double sinHeading,
324  DtDcm& orientation,
325  bool upsideDown = false);
326 
329  const DtVector& rightPoint, const DtVector& otherPoint, double heading,
330  const DtDcm& topoToLocal, DtDcm& orientation);
331 
332 
336 DT_DLL_vrfutil bool DtCalculateNormal(const DtVector& pointA,
337  const DtVector& pointB, const DtVector& pointC, DtVector& normal);
338 
339 
342 DT_DLL_vrfutil void DtCalculateOrientation(DtVector localNormal, double heading,
343  const DtDcm& topoToLocal, DtDcm& localOrientation);
344 
345 
346 DT_DLL_vrfutil double DtFindZInPlane(const double posx, const double posy,
347  const DtVector& pointInPlane, const DtVector& normal);
348 
353 DT_DLL_vrfutil DtVector DtIntersectLineWithPlane(const DtVector& point, const DtVector& direction,
354  const DtVector& pointInPlane, const DtVector& planeNormal,
355  bool* noIntersection = 0);
356 
361  const DtChord& chord, const DtVector& lower, const DtVector& upper,
362  DtVrfChordIntersectRecordList* intList = 0);
363 
367  const DtChord& chord,
368  const DtVector& p1, const DtVector& p2, const DtVector& p3,
369  DtVector* result = 0, double* t = 0);
370 
373  double x1, double y1, double x2, double y2,
374  double z11, double z21, double z12, double z22,
375  double x, double y);
376 
380  const DtChord& chord,
381  double x1, double y1, double x2, double y2,
382  double z11, double z21, double z12, double z22,
385  double tolerance = 1e-20);
386 
390  double heading, const DtVector& position, DtDcm& bodyToRef);
391 
397 DT_DLL_vrfutil void DtTopoEulerToBodyToLocal(const DtTaitBryan& topoEuler,
398  const Coordinate_System& coordSystem, const DtVector& localPosition,
399  DtDcm& bodyToLocalDcm);
400 
401 DT_DLL_vrfutil DtDcm DtRotZToBodyToLocal(const Coordinate_System& coordSystem, double angle,
402  const DtVector& position);
403 DT_DLL_vrfutil DtDcm DtRotYToBodyToLocal(const Coordinate_System& coordSystem, double angle,
404  const DtVector& position);
405 DT_DLL_vrfutil DtDcm DtRotXToBodyToLocal(const Coordinate_System& coordSystem, double angle,
406  const DtVector& position);
407 
410 DT_DLL_vrfutil double DtHeadingFromGeocAToGeocB(const DtVector& geocA, const DtVector& geocB);
411 
415 
416 
418 
419 DT_DLL_vrfutil double DtSin(double r);
420 
421 inline double DtCos(double r)
422 {
423  return DtSin(r + DtPI_OVER_TWO);
424 }
425 
426 inline double DtTan(double r)
427 {
428  double cosR = DtCos(r);
429 
430  if (DtIsZero<double>(cosR))
431  {
432  errno = EDOM;
433  return 0.;
434  }
435 
436  else
437  {
438  return DtSin(r) / cosR;
439  }
440 }
441 
442 DT_DLL_vrfutil double DtAsin(double x);
443 
444 inline double DtAcos(double x)
445 {
446  return DtPI_OVER_TWO + DtAsin(-x);
447 }
448 
449 DT_DLL_vrfutil double DtAtan(double x);
450 DT_DLL_vrfutil double DtAtan2(double y, double x);
451 
452 DT_DLL_vrfutil bool DtSameSign(double x, double y);
453 
454 DT_DLL_vrfutil bool DtPointInSegment(const DtVector& testPoint, const DtVector& segStart,
455  const DtVector& segEnd);
456 
457 /*******************************************************************************
463  *******************************************************************************/
464 
482  DtVector Q1, DtVector* I0 = 0, DtVector* I1 = 0,
483  double* isectParam1 = 0, double *isectParam2 = 0,
484  bool* parallel = 0, bool* collinear = 0);
485 
493 
497 
501  const Coordinate_System& coordinateSystem);
502 
505 
506 DT_DLL_vrfutil double altitudeOfPosition(const DtVector& localPosition,
507  const Coordinate_System& coordinateSystem);
508 DT_DLL_vrfutil double altitudeOfPosition(const DtPoint& localPosition,
509  const Coordinate_System& coordinateSystem);
511 
514 
515 DT_DLL_vrfutil void setAltitudeOfPosition(DtVector& localPosition, double newAltitude,
516  const Coordinate_System& coordinateSystem);
517 DT_DLL_vrfutil void setAltitudeOfPosition(DtPoint& localPosition, double newAltitude,
518  const Coordinate_System& coordinateSystem);
520 
521 
527 
530 DT_DLL_vrfutil double headingAngleTo(const DtVector& observerPosition,
531  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
532 
535 DT_DLL_vrfutil double elevationAngleTo(const DtVector& observerPosition,
536  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
537 
540 DT_DLL_vrfutil double bankAngleTo(const DtVector& observerPosition,
541  const DtVector& targetPosition, const Coordinate_System& coordinateSystem);
542 
545 DT_DLL_vrfutil double distSquaredTo2D(const DtVector& position1, const DtVector& position2,
546  const Coordinate_System& coordinateSystem);
547 
553 DT_DLL_vrfutil bool inside(const DtVector& localPoint,
554  const DtLocalVertexList& localVertexList,
555  const Coordinate_System& coordinateSystem);
556 
557 DT_DLL_vrfutil bool insideEllipsoid(const DtVector& localPoint,
558  const DtLocalVertexList& localVertexList,
559  const Coordinate_System& coordinateSystem);
560 
561 
567 DT_DLL_vrfutil bool leftOf(const DtVector& localPoint,
568  const DtLocalVertexList& localVertexList,
569  const Coordinate_System& coordinateSystem);
570 
576 DT_DLL_vrfutil double headingAngleTo(const DtVector& localPoint,
577  const DtLocalVertexList& localVertexList,
578  const Coordinate_System& coordinateSystem);
579 
584 DT_DLL_vrfutil double elevationAngleTo(const DtVector& localPoint,
585  const DtLocalVertexList& localVertexList,
586  const Coordinate_System& coordinateSystem);
587 
594 DT_DLL_vrfutil double localDistSquaredTo(const DtVector& localPoint,
595  const DtLocalVertexList& localVertexList,
596  const Coordinate_System& coordinateSystem);
597 
602 DT_DLL_vrfutil double distSquaredTo2D(const DtVector& localPoint,
603  const DtLocalVertexList& localVertexList,
604  const Coordinate_System& coordinateSystem);
605 
615 DT_DLL_vrfutil double distToBoundingVolume(const DtVector& localBaseLocation,
616  const Dt3dBoundingVolume* box, const DtTaitBryan& boxToLocalOrientation,
617  const DtVector& testPoint);
618 
624 DT_DLL_vrfutil bool intersects(const DtVector& localPoint1,
625  const DtVector& localPoint2, const DtLocalVertexList& localVertexList,
626  const Coordinate_System& coordinateSystem);
627 
630 DT_DLL_vrfutil DtListItem* getClosestVertex2D(const DtVector& localPoint,
631  const DtLocalVertexList& localVertexList,
632  const Coordinate_System& coordinateSystem);
633 
637 DT_DLL_vrfutil bool getClosestLine2D(const DtVector& localPoint,
638  DtVector& localLinePt1, DtVector& localLinePt2,
639  const DtLocalVertexList& localVertexList,
640  const Coordinate_System& coordinateSystem);
641 
646 DT_DLL_vrfutil double distanceSquaredPointToLine2D(const DtVector& localPoint,
647  const DtVector& localLinePt1, const DtVector& localLinePt2,
648  const Coordinate_System& coordinateSystem);
649 
653  const DtVector& topoLinePt1, const DtVector & topoLinePoint2);
654 
658 DT_DLL_vrfutil double distanceSquaredPointToPoint2D(const DtVector& localLinePt1,
659  const DtVector& localLinePt2, const Coordinate_System& coordinateSystem);
660 
666 DT_DLL_vrfutil double closestPointAlongChord2D( const DtPoint& chordStart,
667  const DtPoint& chordEnd,
668  const DtPoint& testPoint, DtPoint & closestPoint,
669  const Coordinate_System& coordSys);
670 
684  const DtVector& point, const Coordinate_System& coordinateSystem,
685  DtLocalVectorIterator& localVertexIterator);
686 
695 
696 inline double dotProd2D(const DtVector& v1, const DtVector& v2)
697 {
698  return v1[0]*v2[0] + v1[1]*v2[1];
699 }
700 
701 inline double magnitudeSquared2D(const DtVector &v)
702 {
703  return dotProd2D(v, v);
704 }
705 
706 inline double crossProduct2D(const DtVector& v1, const DtVector& v2)
707 {
708  return v1[0]*v2[1] - v1[1]*v2[0];
709 }
710 
712 {
713  DtVector res(v[1], -v[0], v[2]);
714  return res;
715 }
716 
717 inline void normalize2D(DtVector& v)
718 {
719  double length = sqrt(magnitudeSquared2D(v));
720  if (length > 0.0)
721  {
722  v[0] /= length;
723  v[1] /= length;
724  }
725 }
726 
728 inline double vectorAngle2D(DtVector& v)
729 {
730  return DtModPerLo(atan2(v[1], v[0]), -M_PI, M_PI);
731 }
735 
747 DT_DLL_vrfutil void localVectorToGeocentricVector(const DtVector &geocentricPosition,
748  const DtVector& localVector, const Coordinate_System& coordinateSystem,
749  DtVector& geocentricVector);
750 
763  const DtTaitBryan& localOrientation,
764  const Coordinate_System& coordinateSystem,
765  DtTaitBryan& geocentricOrientation);
766 
771  const DtDcm& newOrientation,
772  const DtDcm& oldOrientation, double dT);
773 
776 DT_DLL_vrfutil double calculateSpeedForArrival(double distance, double currentSpeed, double acceleration,
777  double deceleration, double timeToArrive);
778 
789 DT_DLL_vrfutil void geocentricVectorToLocalVector(const DtVector &geocentricPosition,
790  const DtVector& geocentricVector, const Coordinate_System& coordinateSystem,
791  DtVector& localVector);
792 
805  const DtVector& geocentricPosition,
806  const DtTaitBryan& geocentricOrientation,
807  const Coordinate_System& coordinateSystem,
808  DtTaitBryan& localOrientation);
809 
811 DT_DLL_vrfutil int DtIntRandom(int iFrom, int iTo);
812 
814 DT_DLL_vrfutil bool DtIsValidNumber(double x);
815 
818 DT_DLL_vrfutil double DtHoursMinutesSeconds2Seconds(double hours, double minutes, double seconds);
819 
821 DT_DLL_vrfutil void DtSeconds2HoursMinutesSeconds(double totalSeconds, int& hoursOut,
822  int& minutesOut, double& secondsOut);
823 
825 DT_DLL_vrfutil double calculateLengthOfLine(const std::vector<DtVector>& points);
826 
829 DT_DLL_vrfutil double calculateLengthOfLine(const Coordinate_System& coordinateSystem, const std::vector<DtVector>& points);
830 
833 DT_DLL_vrfutil void calculateLengthAndWidthOfShape(const Coordinate_System& coordSytem, const std::vector<DtVector>& points,
834  double& length, double& width);
835 
837 DT_DLL_vrfutil void calculateLengthAndWidthOfShape(const std::vector<DtVector>& points,
838  double& length, double& width);
839 
842 
848  const DtVector & currentLocalPos, const DtVector & localVelocity,
849  const Coordinate_System& coordinateSystem);
850 
862 DT_DLL_vrfutil double illuminationValueAtPosition(const DtGeodeticCoord& position, time_t time,
863  double nighttimeMaximum = 0.1, double illuminationMinimum = 0.001, bool useDayNightIlluminationModel = true,
864  int* sunstate = 0);
865 
872 DT_DLL_vrfutil bool calculateEstimatedTot(const DtVector& localCurrentPos, const DtVector& localTargetPos,
873  double orderedSpeed, double currentSimTime, double currentSpeed, double acceleration,
874  const Coordinate_System& coordinateSystem, double& totResult, double& speedResult);
875 
882 DT_DLL_vrfutil bool calculateEstimatedTot(const DtVector& localCurrentPos, const DtLocalVertexList& localVertexList,
883  double orderedSpeed, double currentSimTime, double currentSpeed, double acceleration,
884  const Coordinate_System& coordinateSystem, double& totResult, double& speedResult);
885 
887 inline bool checkForNAN(const DtVector& vector)
888 {
889  if (boost::math::isnan(vector.x()) ||
890  boost::math::isnan(vector.y()) ||
891  boost::math::isnan(vector.z()))
892  {
893  return true;
894  }
895  else
896  {
897  return false;
898  }
899 }
900 
902 inline bool checkForNAN(const DtTaitBryan& tb)
903 {
904  if (boost::math::isnan(tb.phi()) ||
905  boost::math::isnan(tb.psi()) ||
906  boost::math::isnan(tb.theta()))
907  {
908  return true;
909  }
910  else
911  {
912  return false;
913  }
914 }
915 
917 inline bool checkForNAN(const DtDcm& dcm)
918 {
919  if (boost::math::isnan(dcm[0].x()) ||
920  boost::math::isnan(dcm[0].y()) ||
921  boost::math::isnan(dcm[0].z()) ||
922  boost::math::isnan(dcm[1].x()) ||
923  boost::math::isnan(dcm[1].y()) ||
924  boost::math::isnan(dcm[1].z()) ||
925  boost::math::isnan(dcm[2].x()) ||
926  boost::math::isnan(dcm[2].y()) ||
927  boost::math::isnan(dcm[2].z()))
928  {
929  return true;
930  }
931  else
932  {
933  return false;
934  }
935 }
936 
938 DT_DLL_vrfutil std::map<std::string, std::string> convertToStdStringMap(const std::map<DtString, DtString>& source,
939  bool convertValueForXml = false);
940 
943 
944 #include <boost/algorithm/string.hpp>
945 template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
946 inline SequenceSequenceT& oldBoostSplit(
947  SequenceSequenceT& Result,
948  RangeT& Input,
949  PredicateT Pred,
950  boost::algorithm::token_compress_mode_type eCompress=boost::algorithm::token_compress_off )
951 {
952  if (Input.length())
953  {
954  ::boost::algorithm::iter_split(
955  Result,
956  Input,
957  ::boost::algorithm::token_finder( Pred, eCompress ) );
958  }
959 
960  return Result;
961 }
DT_DLL_vrfutil void DtParallelAxisTheorem(DtConstDcm inertiaInOriginalFrame, double mass, const DtVector &newToOriginal, DtDcm &inertiaInNewFrame)
double DtVecMag(const DtVector &vec)
Definition: kinematicTools.h:201
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:266
#define DtSIGN(x)
Boost includes.
Definition: kinematicTools.h:25
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords.
Definition: vrfChordIntersectRecordList.h:31
double DtOutput(double input)
Definition: kinematicTools.h:268
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 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:206
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:728
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:247
File: lclVecIter.h.
Definition: localVectorIterator.h:25
DT_DLL_vrfutil DtPoint DtVector2DtPoint(const DtVector &p)
DtVector rotateRight2D(const DtVector &v)
Definition: kinematicTools.h:711
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:275
A nonlinearity of zero gives you a simple linear relation: output = gain * input. ...
Definition: kinematicTools.h:253
DT_DLL_vrfutil DtVector localGravityAcceleration(const DtVector &localPosition, const Coordinate_System &coordinateSystem)
Terrain related functions.
const DtVector & getPrevOutput()
Definition: kinematicTools.h:244
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:274
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:421
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:248
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:263
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:696
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:887
double DtAcos(double x)
Definition: kinematicTools.h:444
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:717
DT_DLL_vrfutil double gaussianRandom()
Generates a Gaussian random number using the Marsaglia polar method.
const char * source
Definition: lz4.h:436
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:706
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:426
double magnitudeSquared2D(const DtVector &v)
Definition: kinematicTools.h:701
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:267
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...
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:946
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 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:256
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:229
DT_DLL_vrfutil void DtRotX(double angle, DtDcm &rotMat)
double getPole()
Definition: kinematicTools.h:243
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:264
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 Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)