File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 11#include " triangle.h"
22
3+ #include < algorithm>
34#include < cmath>
45#include < compare>
56
7+ #include " base/math/floating.h"
8+
69#include " line.h"
710
811namespace Geom
@@ -26,12 +29,16 @@ double Triangle::distance(const Point &point) const
2629 using std::is_gteq;
2730 using std::is_lteq;
2831 using std::is_neq;
29- if (auto r1 = rot_dir (points[0 ], points[1 ], point),
30- r2 = rot_dir (points[1 ], points[2 ], point),
31- r3 = rot_dir (points[2 ], points[0 ], point);
32- (is_neq (r1) || is_neq (r2) || is_neq (r3))
33- && ((is_lteq (r1) && is_lteq (r2) && is_lteq (r3))
34- || (is_gteq (r1) && is_gteq (r2) && is_gteq (r3))))
32+ const auto r1 = rot_dir (points[0 ], points[1 ], point);
33+ const auto r2 = rot_dir (points[1 ], points[2 ], point);
34+ const auto r3 = rot_dir (points[2 ], points[0 ], point);
35+
36+ if (const auto non_singular =
37+ is_neq (r1) || is_neq (r2) || is_neq (r3),
38+ rotate_to_same_dir =
39+ (is_lteq (r1) && is_lteq (r2) && is_lteq (r3))
40+ || (is_gteq (r1) && is_gteq (r2) && is_gteq (r3));
41+ non_singular && rotate_to_same_dir)
3542 return 0.0 ;
3643
3744 return std::min ({Line{points[0 ], points[1 ]}.distance (point),
Original file line number Diff line number Diff line change @@ -123,14 +123,13 @@ void Planner::createPlan(const Gen::Plot &source,
123123 addMorph (SectionId::coordSystem, std::max (step, posDuration));
124124
125125 const ::Anim::Easing *geomEasing{&inOut5};
126- if (auto &&targetCircle =
127- trgOpt->geometry == Gen::ShapeType::circle;
128- srcOpt->geometry == Gen::ShapeType::circle
129- || (!targetCircle
130- && srcOpt->geometry == Gen::ShapeType::line))
126+ if (srcOpt->geometry == Gen::ShapeType::circle)
131127 geomEasing = &in3;
132- else if (targetCircle
133- || trgOpt->geometry == Gen::ShapeType::line)
128+ else if (trgOpt->geometry == Gen::ShapeType::circle)
129+ geomEasing = &out3;
130+ else if (srcOpt->geometry == Gen::ShapeType::line)
131+ geomEasing = &in3;
132+ else if (trgOpt->geometry == Gen::ShapeType::line)
134133 geomEasing = &out3;
135134
136135 addMorph (SectionId::geometry,
You can’t perform that action at this time.
0 commit comments