opensurgsim
LinearMotionArithmetic-inl.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_MATH_LINEARMOTIONARITHMETIC_INL_H
17 #define SURGSIM_MATH_LINEARMOTIONARITHMETIC_INL_H
18 
19 namespace SurgSim
20 {
21 namespace Math
22 {
23 
24 template <typename T>
25 LinearMotion<T>::LinearMotion() : m_start(static_cast<T>(0)), m_end(static_cast<T>(0)) {}
26 
27 template <typename T>
28 LinearMotion<T>::LinearMotion(const T& start, const T& end) : m_start(start), m_end(end) {}
29 
30 template <typename T>
31 LinearMotion<T>::LinearMotion(const LinearMotion<T>& m) : m_start(m.m_start), m_end(m.m_end) {}
32 
33 template <typename T>
35 {
36  *this = std::move(m);
37 }
38 
39 template <typename T>
41 {
42  m_start = m.m_start;
43  m_end = m.m_end;
44  return *this;
45 }
46 
47 template <typename T>
49 {
50  m_start = std::move(m.m_start);
51  m_end = std::move(m.m_end);
52  return *this;
53 }
54 
55 template <typename T>
57 {
58  return Interval<T>::minToMax(m_start, m_end);
59 }
60 
61 template <typename T>
63 {
64  return Polynomial<T, 1>(m_start, m_end - m_start);
65 }
66 
67 template <typename T>
69 {
70  return toInterval().containsZero();
71 }
72 
73 template <typename T>
74 bool LinearMotion<T>::isApprox(const LinearMotion<T>& m, const T& epsilon) const
75 {
76  return (std::abs(m_start - m.m_start) <= epsilon) && (std::abs(m_end - m.m_end) <= epsilon);
77 }
78 
79 template <typename T>
81 {
82  return ((m_start == m.m_start) && (m_end == m.m_end));
83 }
84 
85 template <typename T>
87 {
88  return !(*this == m);
89 }
90 
91 template <typename T>
93 {
94  return LinearMotion<T>(m_start + m.m_start, m_end + m.m_end);
95 }
96 
97 template <typename T>
99 {
100  m_start += m.m_start;
101  m_end += m.m_end;
102  return *this;
103 }
104 
105 template <typename T>
107 {
108  return LinearMotion<T>(m_start - m.m_start, m_end - m.m_end);
109 }
110 
111 template <typename T>
113 {
114  m_start -= m.m_start;
115  m_end -= m.m_end;
116  return *this;
117 }
118 
119 template <typename T>
121 {
122  return this->toInterval() * m.toInterval();
123 }
124 
125 template <typename T>
127 {
128  return this->toInterval() / m.toInterval();
129 }
130 
131 template <typename T>
133 {
134  return m_start;
135 }
136 
137 template <typename T>
139 {
140  return m_end;
141 }
142 
143 template <typename T>
144 T LinearMotion<T>::atTime(const T& t) const
145 {
146  return ((static_cast<T>(1) - t) * m_start + t * m_end);
147 }
148 
149 template <typename T>
151 {
152  return LinearMotion<T>(m_start, (m_start + m_end) * static_cast<T>(0.5));
153 }
154 
155 template <typename T>
157 {
158  return LinearMotion<T>((m_start + m_end) * static_cast<T>(0.5), m_end);
159 }
160 
161 // Class ND
162 template <typename T, int N>
164 {
165 }
166 
167 template <typename T, int N>
169 {
170  m_motion = x;
171 }
172 
173 template <typename T, int N>
175 {
176  m_motion = motion.m_motion;
177 }
178 
179 template <typename T, int N>
181 {
182  *this = std::move(motion);
183 }
184 
185 template <typename T, int N>
186 LinearMotionND<T, N>::LinearMotionND(const std::array<T, N>& a, const std::array<T, N>& b)
187 {
188  for (int i = 0; i < N; ++i)
189  {
190  m_motion[i] = LinearMotion<T>(a[i], b[i]);
191  }
192 }
193 
194 template <typename T, int N>
196 {
197  m_motion = motion.m_motion;
198  return *this;
199 }
200 
201 template <typename T, int N>
203 {
204  if (this != &motion)
205  {
206  m_motion = std::move(motion.m_motion);
207  }
208 
209  return *this;
210 }
211 
212 template <typename T, int N>
214 {
215  std::array<Interval<T>, N> motions;
216  for (int i = 0; i < N; ++i)
217  {
218  motions[i] = m_motion[i].toInterval();
219  }
220 
221  return IntervalND<T, N>(motions);
222 }
223 
224 template <typename T, int N>
225 bool LinearMotionND<T, N>::isApprox(const LinearMotionND<T, N>& motion, const T& epsilon) const
226 {
227  for (int i = 0; i < N; i++)
228  {
229  if (!m_motion[i].isApprox(motion.m_interval[i], epsilon))
230  {
231  return false;
232  }
233  }
234  return true;
235 }
236 
237 template <typename T, int N>
239 {
240  return (m_motion == motion.m_motion);
241 }
242 
243 template <typename T, int N>
245 {
246  return !(this->operator==(motion));
247 }
248 
249 template <typename T, int N>
251 {
252  LinearMotionND<T, N> ret(*this);
253  ret += m;
254  return ret;
255 }
256 
257 template <typename T, int N>
259 {
260  for (int i = 0; i < N; ++i)
261  {
262  m_motion[i] += m.m_motion[i];
263  }
264  return *this;
265 }
266 
267 template <typename T, int N>
269 {
270  LinearMotionND<T, N> ret(*this);
271  ret -= m;
272  return ret;
273 }
274 
275 template <typename T, int N>
277 {
278  for (int i = 0; i < N; ++i)
279  {
280  m_motion[i] -= m.m_motion[i];
281  }
282  return *this;
283 }
284 
285 template <typename T, int N>
287 {
288  return this->toInterval() * m.toInterval();
289 }
290 
291 template <typename T, int N>
293 {
294  return this->toInterval() / m.toInterval();
295 }
296 
297 template <typename T, int N>
299 {
300  Interval<T> ret(static_cast<T>(0), static_cast<T>(0));
301  for (int i = 0 ; i < N ; i++)
302  {
303  ret += m_motion[i] * motion.m_motion[i];
304  }
305  return ret;
306 }
307 
308 template <typename T, int N>
310 {
311  SURGSIM_ASSERT((i >= 0) && (i < N)) << "Asking for an axis greater than the dimensionality of the linear motion";
312  return m_motion[i];
313 }
314 
315 template <typename T, int N>
316 void LinearMotionND<T, N>::getStart(std::array<T, N>* start) const
317 {
318  for (int i = 0; i < N; ++i)
319  {
320  (*start)[i] = m_motion[i].getStart();
321  }
322 }
323 
324 template <typename T, int N>
325 void LinearMotionND<T, N>::getEnd(std::array<T, N>* end) const
326 {
327  for (int i = 0; i < N; ++i)
328  {
329  (*end)[i] = m_motion[i].getEnd();
330  }
331 }
332 
333 template <typename T, int N>
335 {
337  for (int i = 0; i < N; ++i)
338  {
339  ret.m_motion[i] = m_motion[i].firstHalf();
340  }
341  return ret;
342 }
343 
344 template <typename T, int N>
346 {
348  for (int i = 0; i < N; ++i)
349  {
350  ret.m_motion[i] = m_motion[i].secondHalf();
351  }
352  return ret;
353 }
354 
355 // Special case for dimension 3
356 template <typename T>
358 {
359 }
360 
361 template <typename T>
363 {
364  m_motion[0] = x[0];
365  m_motion[1] = x[1];
366  m_motion[2] = x[2];
367 }
368 
369 template <typename T>
371 {
372  m_motion[0] = a;
373  m_motion[1] = b;
374  m_motion[2] = c;
375 }
376 
377 template <typename T>
379 {
380  m_motion[0] = motion.m_motion[0];
381  m_motion[1] = motion.m_motion[1];
382  m_motion[2] = motion.m_motion[2];
383 }
384 
385 template <typename T>
387 {
388  *this = std::move(motion);
389 }
390 
391 template <typename T>
392 LinearMotionND<T, 3>::LinearMotionND(const std::array<T, 3>& start, const std::array<T, 3>& end)
393 {
394  m_motion[0] = LinearMotion<T>(start[0], end[0]);
395  m_motion[1] = LinearMotion<T>(start[1], end[1]);
396  m_motion[2] = LinearMotion<T>(start[2], end[2]);
397 }
398 
399 template <typename T>
401 {
402  m_motion[0] = LinearMotion<T>(start[0], end[0]);
403  m_motion[1] = LinearMotion<T>(start[1], end[1]);
404  m_motion[2] = LinearMotion<T>(start[2], end[2]);
405 }
406 
407 template <typename T>
409 {
410  m_motion[0] = motion.m_motion[0];
411  m_motion[1] = motion.m_motion[1];
412  m_motion[2] = motion.m_motion[2];
413  return *this;
414 }
415 
416 template <typename T>
418 {
419  m_motion[0] = std::move(motion.m_motion[0]);
420  m_motion[1] = std::move(motion.m_motion[1]);
421  m_motion[2] = std::move(motion.m_motion[2]);
422  return *this;
423 }
424 
425 template <typename T>
427 {
428  std::array<Interval<T>, 3> intervals;
429  intervals[0] = m_motion[0].toInterval();
430  intervals[1] = m_motion[1].toInterval();
431  intervals[2] = m_motion[2].toInterval();
432  return IntervalND<T, 3>(intervals);
433 }
434 
435 template <typename T>
436 bool LinearMotionND<T, 3>::isApprox(const LinearMotionND<T, 3>& motion, const T& epsilon) const
437 {
438  return (m_motion[0].isApprox(motion.m_motion[0], epsilon) &&
439  m_motion[1].isApprox(motion.m_motion[1], epsilon) &&
440  m_motion[2].isApprox(motion.m_motion[2], epsilon));
441 }
442 
443 template <typename T>
445 {
446  return (m_motion[0] == motion.m_motion[0] &&
447  m_motion[1] == motion.m_motion[1] &&
448  m_motion[2] == motion.m_motion[2]);
449 }
450 
451 template <typename T>
453 {
454  return !(this->operator==(motion));
455 }
456 
457 template <typename T>
459 {
460  LinearMotionND<T, 3> ret(*this);
461  ret += m;
462  return ret;
463 }
464 
465 template <typename T>
467 {
468  m_motion[0] += m.m_motion[0];
469  m_motion[1] += m.m_motion[1];
470  m_motion[2] += m.m_motion[2];
471  return *this;
472 }
473 
474 template <typename T>
476 {
477  LinearMotionND<T, 3> ret(*this);
478  ret -= m;
479  return ret;
480 }
481 
482 template <typename T>
484 {
485  m_motion[0] -= m.m_motion[0];
486  m_motion[1] -= m.m_motion[1];
487  m_motion[2] -= m.m_motion[2];
488  return *this;
489 }
490 
491 template <typename T>
493 {
494  return this->toInterval() * m.toInterval();
495 }
496 
497 template <typename T>
499 {
500  return this->toInterval() / m.toInterval();
501 }
502 
503 template <typename T>
505 {
506  return valuesOverInterval(analyticDotProduct(*this, motion), range);
507 }
508 
509 template <typename T>
511  const Interval<T>& range) const
512 {
513  // toInterval().crossProduct(motion.toInterval())
514  // results in intervals that are too broad.
515  return IntervalND<T, 3>(valuesOverInterval(analyticCrossProductAxis<double, 0>(*this, motion), range),
516  valuesOverInterval(analyticCrossProductAxis<double, 1>(*this, motion), range),
517  valuesOverInterval(analyticCrossProductAxis<double, 2>(*this, motion), range));
518 }
519 
520 template <typename T>
522 {
523  return valuesOverInterval(analyticMagnitudeSquared(*this), range);
524 }
525 
526 template <typename T>
528 {
529  Interval<T> magnitudeSq = magnitudeSquared(range);
530  // Both minimum and maximum are guaranteed to be non-negative.
531  return Interval<T>(sqrt(magnitudeSq.getMin()), sqrt(magnitudeSq.getMax()));
532 }
533 
534 template <typename T>
536 {
537  SURGSIM_ASSERT((i >= 0) && (i < 3)) << "Asking for an axis greater than the dimensionality of the linear motion";
538  return m_motion[i];
539 }
540 
541 template <typename T>
542 void LinearMotionND<T, 3>::getStart(std::array<T, 3>* start) const
543 {
544  (*start)[0] = m_motion[0].getStart();
545  (*start)[1] = m_motion[1].getStart();
546  (*start)[2] = m_motion[2].getStart();
547 }
548 
549 template <typename T>
550 void LinearMotionND<T, 3>::getEnd(std::array<T, 3>* end) const
551 {
552  (*end)[0] = m_motion[0].getEnd();
553  (*end)[1] = m_motion[1].getEnd();
554  (*end)[2] = m_motion[2].getEnd();
555 }
556 
557 template <typename T>
559 {
560  return LinearMotionND<T, 3>::Vector3(m_motion[0].getStart(), m_motion[1].getStart(), m_motion[2].getStart());
561 }
562 
563 template <typename T>
565 {
566  return Vector3(m_motion[0].getEnd(), m_motion[1].getEnd(), m_motion[2].getEnd());
567 }
568 
569 template <typename T>
571 {
572  return Vector3(m_motion[0].atTime(t), m_motion[1].atTime(t), m_motion[2].atTime(t));
573 }
574 
575 template <typename T>
577 {
579  ret.m_motion[0] = m_motion[0].firstHalf();
580  ret.m_motion[1] = m_motion[1].firstHalf();
581  ret.m_motion[2] = m_motion[2].firstHalf();
582  return ret;
583 }
584 
585 template <typename T>
587 {
589  ret.m_motion[0] = m_motion[0].secondHalf();
590  ret.m_motion[1] = m_motion[1].secondHalf();
591  ret.m_motion[2] = m_motion[2].secondHalf();
592  return ret;
593 }
594 
595 // Utility functions not part of any class
596 
597 // Interval functions
598 template <typename T>
599 std::ostream& operator<<(std::ostream& o, const LinearMotion<T>& motion)
600 {
601  o << "(" << motion.getStart() << " -> " << motion.getEnd() << ")";
602  return o;
603 }
604 
605 // Interval ND functions
606 template <typename T, int N>
607 std::ostream& operator<<(std::ostream& o, const LinearMotionND<T, N>& motion)
608 {
609  o << "([" << motion.getAxis(0).getStart();
610  for (int i = 1; i < N; ++i)
611  {
612  o << "," << motion.getAxis(i).getStart();
613  }
614  o << "] -> [" << motion.getAxis(0).getEnd();
615  for (int i = 1; i < N; ++i)
616  {
617  o << "," << motion.getAxis(i).getEnd();
618  }
619  o << "])";
620  return o;
621 }
622 
623 // Interval 3D functions
624 template <typename T>
625 Polynomial<T, 2> analyticDotProduct(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b)
626 {
627  return a.getAxis(0).toPolynomial() * b.getAxis(0).toPolynomial() +
628  a.getAxis(1).toPolynomial() * b.getAxis(1).toPolynomial() +
629  a.getAxis(2).toPolynomial() * b.getAxis(2).toPolynomial();
630 }
631 
632 template <typename T, int A>
633 Polynomial<T, 2> analyticCrossProductAxis(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b)
634 {
635  // The labels here are probably a bit confusing for anyone else, but at least this makes sense.
636  // For A == 0, the "Y" and "Z" mean what they say, and the output is the X component.
637  // For A == 1, they get rotated "down" by one (so Y -> Z, Z -> X), and the output is the Y component.
638  // For A == 2, they get rotated "down" by two (so Y -> X, Z -> Y), and the output is the Z component.
639  const LinearMotion<T>& aY = a.getAxis((A + 1) % 3);
640  const LinearMotion<T>& aZ = a.getAxis((A + 2) % 3);
641  const LinearMotion<T>& bY = b.getAxis((A + 1) % 3);
642  const LinearMotion<T>& bZ = b.getAxis((A + 2) % 3);
643  return aY.toPolynomial() * bZ.toPolynomial() - aZ.toPolynomial() * bY.toPolynomial();
644 }
645 
646 template <typename T>
647 Polynomial<T, 2> analyticCrossProductXAxis(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b)
648 {
649  return analyticCrossProductAxis<double, 0>(a, b);
650 }
651 
652 template <typename T>
653 Polynomial<T, 2> analyticCrossProductYAxis(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b)
654 {
655  return analyticCrossProductAxis<double, 1>(a, b);
656 }
657 
658 template <typename T>
659 Polynomial<T, 2> analyticCrossProductZAxis(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b)
660 {
661  return analyticCrossProductAxis<double, 2>(a, b);
662 }
663 
664 template <typename T>
665 void analyticCrossProduct(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b,
666  Polynomial<T, 2>* resultXAxis, Polynomial<T, 2>* resultYAxis, Polynomial<T, 2>* resultZAxis)
667 {
668  (*resultXAxis) = analyticCrossProductXAxis(a, b);
669  (*resultYAxis) = analyticCrossProductYAxis(a, b);
670  (*resultZAxis) = analyticCrossProductZAxis(a, b);
671 }
672 
673 template <typename T>
674 Polynomial <T, 3> analyticTripleProduct(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b,
675  const LinearMotionND<T, 3>& c)
676 {
677  const Polynomial<T, 1> aX = a.getAxis(0).toPolynomial();
678  const Polynomial<T, 1> aY = a.getAxis(1).toPolynomial();
679  const Polynomial<T, 1> aZ = a.getAxis(2).toPolynomial();
680  const Polynomial<T, 1> bX = b.getAxis(0).toPolynomial();
681  const Polynomial<T, 1> bY = b.getAxis(1).toPolynomial();
682  const Polynomial<T, 1> bZ = b.getAxis(2).toPolynomial();
683  const Polynomial<T, 1> cX = c.getAxis(0).toPolynomial();
684  const Polynomial<T, 1> cY = c.getAxis(1).toPolynomial();
685  const Polynomial<T, 1> cZ = c.getAxis(2).toPolynomial();
686  return ((bY * cZ - bZ * cY) * aX + (bZ * cX - bX * cZ) * aY + (bX * cY - bY * cX) * aZ);
687 }
688 
689 template <typename T>
690 static Interval<T> tripleProduct(const LinearMotionND<T, 3>& a, const LinearMotionND<T, 3>& b,
691  const LinearMotionND<T, 3>& c, const Interval<T>& range)
692 {
693  return valuesOverInterval(analyticTripleProduct(a, b, c), range);
694 }
695 
696 template <typename T>
697 Polynomial<T, 2> analyticMagnitudeSquared(const LinearMotionND<T, 3>& motion)
698 {
699  return analyticDotProduct(motion, motion);
700 }
701 
702 }; // Math
703 }; // SurgSim
704 
705 #endif // SURGSIM_MATH_LINEARMOTIONARITHMETIC_INL_H
LinearMotionND()
Constructor.
Definition: LinearMotionArithmetic-inl.h:163
IntervalND< T, N > operator/(const LinearMotionND< T, N > &m) const
Standard arithmetic operators extended to interval groups.
Definition: LinearMotionArithmetic-inl.h:292
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
T getMin() const
Definition: IntervalArithmetic-inl.h:283
bool isApprox(const LinearMotion< T > &i, const T &epsilon) const
Definition: LinearMotionArithmetic-inl.h:74
T getEnd() const
Definition: LinearMotionArithmetic-inl.h:138
IntervalND<T,3> defines the concept of a group of mathematical intervals specialized to 3 intervals a...
Definition: IntervalArithmetic.h:307
const LinearMotion< T > & getAxis(int i) const
Definition: LinearMotionArithmetic-inl.h:535
IntervalND< T, 3 > toInterval() const
Convert from LinearMotion to an Interval.
Definition: LinearMotionArithmetic-inl.h:426
void getStart(std::array< T, 3 > *start) const
Definition: LinearMotionArithmetic-inl.h:542
LinearMotionND<T, 3> specializes the LinearMotionND<T, N> class for 3 dimensions. ...
Definition: LinearMotionArithmetic.h:258
Interval< T > dotProduct(const LinearMotionND< T, N > &motion) const
Definition: LinearMotionArithmetic-inl.h:298
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
T getMax() const
Definition: IntervalArithmetic-inl.h:289
void getEnd(std::array< T, N > *end) const
Definition: LinearMotionArithmetic-inl.h:325
Polynomial<T, 3> specializes the Polynomial class for degree 3 (cubic polynomials) ...
Definition: Polynomial.h:255
IntervalND defines the concept of a group of mathematical intervals and provides operations on them i...
Definition: IntervalArithmetic.h:199
LinearMotionND< T, N > secondHalf() const
Definition: LinearMotionArithmetic-inl.h:345
LinearMotion< T > firstHalf() const
Definition: LinearMotionArithmetic-inl.h:150
bool isApprox(const LinearMotionND< T, N > &motion, const T &epsilon) const
Definition: LinearMotionArithmetic-inl.h:225
Polynomial<T, 2> specializes the Polynomial class for degree 2 (quadratic polynomials) ...
Definition: Polynomial.h:183
LinearMotion< T > secondHalf() const
Definition: LinearMotionArithmetic-inl.h:156
IntervalND< T, N > operator*(const LinearMotionND< T, N > &m) const
Standard arithmetic operators extended to interval groups.
Definition: LinearMotionArithmetic-inl.h:286
T getStart() const
Definition: LinearMotionArithmetic-inl.h:132
bool containsZero() const
Definition: LinearMotionArithmetic-inl.h:68
LinearMotionND< T, N > operator+(const LinearMotionND< T, N > &m) const
Definition: LinearMotionArithmetic-inl.h:250
void getStart(std::array< T, N > *start) const
Definition: LinearMotionArithmetic-inl.h:316
LinearMotionND< T, N > & operator=(const LinearMotionND< T, N > &motion)
Assignment operator.
Definition: LinearMotionArithmetic-inl.h:195
Interval< T > operator/(const LinearMotion< T > &m) const
Standard arithmetic operators extended to interval groups.
Definition: LinearMotionArithmetic-inl.h:126
LinearMotion< T > & operator=(const LinearMotion< T > &m)
Assignment operator.
Definition: LinearMotionArithmetic-inl.h:40
Eigen::Matrix< T, 3, 1 > Vector3
Typedef for a vector 3 return.
Definition: LinearMotionArithmetic.h:262
bool operator!=(const LinearMotion< T > &m) const
Definition: LinearMotionArithmetic-inl.h:86
const LinearMotion< T > & getAxis(int i) const
Definition: LinearMotionArithmetic-inl.h:309
LinearMotion()
Constructor.
Definition: LinearMotionArithmetic-inl.h:25
Interval defines the concept of a mathematical interval and provides operations on it including arith...
Definition: IntervalArithmetic.h:34
Interval< T > operator*(const LinearMotion< T > &m) const
Standard arithmetic operators extended to interval groups.
Definition: LinearMotionArithmetic-inl.h:120
LinearMotion< T > operator+(const LinearMotion< T > &m) const
Definition: LinearMotionArithmetic-inl.h:92
Interval< T > toInterval() const
Convert from LinearMotion to an Interval.
Definition: LinearMotionArithmetic-inl.h:56
LinearMotionND<T, N> defines the concept of a group of linear motions and provides operations on them...
Definition: LinearMotionArithmetic.h:156
Polynomial< T, 1 > toPolynomial() const
Returns a linear expression (degree-1 polynomial) whose value for t=0..1 progresses from `start&#39; to `...
Definition: LinearMotionArithmetic-inl.h:62
Polynomial<T, 1> specializes the Polynomial class for degree 1 (linear polynomials) ...
Definition: Polynomial.h:117
T atTime(const T &t) const
Definition: LinearMotionArithmetic-inl.h:144
bool operator==(const LinearMotion< T > &m) const
Definition: LinearMotionArithmetic-inl.h:80
LinearMotionND< T, N > firstHalf() const
Definition: LinearMotionArithmetic-inl.h:334
LinearMotion is (intentionally) a lot like Interval, but it deals with linear motion where all operan...
Definition: LinearMotionArithmetic.h:50
IntervalND< T, N > toInterval() const
Convert from LinearMotion to an Interval.
Definition: LinearMotionArithmetic-inl.h:213
bool operator==(const LinearMotionND< T, N > &motion) const
Definition: LinearMotionArithmetic-inl.h:238
bool operator!=(const LinearMotionND< T, N > &motion) const
Definition: LinearMotionArithmetic-inl.h:244
static Interval< T > minToMax(const T &a1, const T &a2)
Generate an interval from min to max based on the inputs.
Definition: IntervalArithmetic-inl.h:62