Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
point_test.cc
Go to the documentation of this file.
1
2/*
3 Aleph_w
4
5 Data structures & Algorithms
6 version 2.0.0b
7 https://github.com/lrleon/Aleph-w
8
9 This file is part of Aleph-w library
10
11 Copyright (c) 2002-2026 Leandro Rabindranath Leon
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in all
21 copies or substantial portions of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 SOFTWARE.
30*/
31
32
52#include <gtest/gtest.h>
53#include <cmath>
54#include <unordered_set>
55#include <utility>
56#include <point.H>
57
58using namespace Aleph;
59
60// Tolerance for floating-point comparisons
61constexpr double EPSILON = 1e-9;
62
63// Helper to compare Geom_Number with tolerance
64bool approx_equal(const Geom_Number & a, const Geom_Number & b,
65 double tol = EPSILON)
66{
67 return std::abs(a.get_d() - b.get_d()) < tol;
68}
69
70bool approx_equal(double a, double b, double tol = EPSILON)
71{
72 return std::abs(a - b) < tol;
73}
74
75//============================================================================
76// Point Tests
77//============================================================================
78
79class PointTest : public ::testing::Test
80{
81protected:
83 Point p1{1, 2};
84 Point p2{3, 4};
85 Point p3{-1, -1};
86};
87
88TEST_F(PointTest, DefaultConstruction)
89{
90 EXPECT_EQ(origin.get_x(), 0);
91 EXPECT_EQ(origin.get_y(), 0);
92}
93
94TEST_F(PointTest, ParameterizedConstruction)
95{
96 EXPECT_EQ(p1.get_x(), 1);
97 EXPECT_EQ(p1.get_y(), 2);
98}
99
101{
102 Point p1_copy{1, 2};
103 EXPECT_EQ(p1, p1_copy);
104 EXPECT_NE(p1, p2);
105}
106
108{
109 Point sum = p1 + p2;
110 EXPECT_EQ(sum.get_x(), 4);
111 EXPECT_EQ(sum.get_y(), 6);
112}
113
114TEST_F(PointTest, AdditionAssignment)
115{
116 Point p = p1;
117 p += p2;
118 EXPECT_EQ(p.get_x(), 4);
119 EXPECT_EQ(p.get_y(), 6);
120}
121
122TEST_F(PointTest, Subtraction)
123{
124 Point diff = p2 - p1;
125 EXPECT_EQ(diff.get_x(), 2);
126 EXPECT_EQ(diff.get_y(), 2);
127}
128
129TEST_F(PointTest, SubtractionAssignment)
130{
131 Point p = p2;
132 p -= p1;
133 EXPECT_EQ(p.get_x(), 2);
134 EXPECT_EQ(p.get_y(), 2);
135}
136
138{
139 std::string str = origin.to_string();
140 EXPECT_FALSE(str.empty());
141 EXPECT_NE(str.find("0"), std::string::npos);
142}
143
144TEST_F(PointTest, StringCastOperator)
145{
146 std::string str = static_cast<std::string>(p1);
147 EXPECT_FALSE(str.empty());
148}
149
150TEST_F(PointTest, DistanceWith)
151{
152 Point a{0, 0};
153 Point b{3, 4};
154 Geom_Number dist = a.distance_to(b);
155 EXPECT_TRUE(approx_equal(dist, 5.0));
156}
157
158TEST_F(PointTest, DistanceSquaredTo)
159{
160 Point a{0, 0};
161 Point b{3, 4};
162 Geom_Number dist_sq = a.distance_squared_to(b);
163 EXPECT_EQ(dist_sq, 25);
164}
165
166TEST_F(PointTest, IsColinearWithPoints)
167{
168 Point a{0, 0};
169 Point b{1, 1};
170 Point c{2, 2};
171 Point d{1, 0};
172
173 EXPECT_TRUE(a.is_colinear_with(b, c));
174 EXPECT_FALSE(a.is_colinear_with(b, d));
175}
176
177TEST_F(PointTest, IsToLeftFrom)
178{
179 Point a{0, 0};
180 Point b{1, 0};
181 Point left{0.5, 1};
182 Point right{0.5, -1};
183
184 EXPECT_TRUE(left.is_left_of(a, b));
185 EXPECT_FALSE(right.is_left_of(a, b));
186}
187
188TEST_F(PointTest, IsToRightFrom)
189{
190 Point a{0, 0};
191 Point b{1, 0};
192 Point left{0.5, 1};
193 Point right{0.5, -1};
194
195 EXPECT_TRUE(right.is_to_right_from(a, b)); // intentionally kept with legacy name for this overload (backward compatibility; differs from is_left_of naming pattern)
196 EXPECT_FALSE(left.is_to_right_from(a, b));
197}
198
199TEST_F(PointTest, IsToLeftOnFrom)
200{
201 Point a{0, 0};
202 Point b{1, 0};
203 Point on_line{0.5, 0};
204 Point left{0.5, 1};
205
206 EXPECT_TRUE(on_line.is_to_left_on_from(a, b)); // not deprecated
207 EXPECT_TRUE(left.is_to_left_on_from(a, b));
208}
209
210TEST_F(PointTest, IsClockwiseWith)
211{
212 Point a{0, 0};
213 Point b{1, 0};
214 Point c{0.5, -1}; // Below line a-b -> clockwise
215
216 EXPECT_TRUE(a.is_clockwise_with(b, c));
217}
218
219TEST_F(PointTest, IsBetween)
220{
221 Point a{0, 0};
222 Point b{2, 2};
223 Point between{1, 1};
224 Point outside{3, 3};
225
226 EXPECT_TRUE(between.is_between(a, b));
227 EXPECT_FALSE(outside.is_between(a, b));
228}
229
230TEST_F(PointTest, NearestPoint)
231{
232 Point ref{0, 0};
233 Point near{1, 1};
234 Point far{10, 10};
235
236 const Point & nearest = ref.nearest_point(near, far);
237 EXPECT_EQ(nearest, near);
238}
239
240TEST_F(PointTest, HighestLowestLeftmostRightmost)
241{
242 EXPECT_EQ(p1.highest_point(), p1);
243 EXPECT_EQ(p1.lowest_point(), p1);
244 EXPECT_EQ(p1.leftmost_point(), p1);
245 EXPECT_EQ(p1.rightmost_point(), p1);
246}
247
248TEST_F(PointTest, NormNormalizeRotateAndLerp)
249{
250 Point v{3, 4};
251 EXPECT_EQ(v.norm_squared(), Geom_Number(25));
252 EXPECT_TRUE(approx_equal(v.norm(), Geom_Number(5), 1e-9));
253
254 Point unit = v.normalize();
255 EXPECT_TRUE(approx_equal(unit.norm(), Geom_Number(1), 1e-6));
256
257 Point rotated = Point(1, 0).rotate(Geom_Number(PI_2));
258 EXPECT_TRUE(approx_equal(rotated.get_x(), Geom_Number(0), 1e-6));
259 EXPECT_TRUE(approx_equal(rotated.get_y(), Geom_Number(1), 1e-6));
260
261 Point a{0, 0};
262 Point b{10, 10};
263 EXPECT_EQ(a.midpoint(b), Point(5, 5));
264 EXPECT_EQ(a.lerp(b, Geom_Number(1, 2)), Point(5, 5));
265 EXPECT_EQ(Geom_Number(2) * Point(3, 4), Point(6, 8));
266}
267
268TEST_F(PointTest, LexicographicOrder)
269{
270 EXPECT_TRUE(Point(0, 0) < Point(0, 1));
271 EXPECT_TRUE(Point(0, 1) < Point(1, 0));
272 EXPECT_FALSE(Point(1, 0) < Point(1, 0));
273}
274
275TEST_F(PointTest, HashSupport)
276{
277 std::unordered_set<Point> set;
278 set.insert(Point(1, 2));
279 EXPECT_EQ(set.count(Point(1, 2)), 1u);
280}
281
282//============================================================================
283// Polar_Point Tests
284//============================================================================
285
286class PolarPointTest : public ::testing::Test
287{
288protected:
291};
292
293TEST_F(PolarPointTest, ConversionFromCartesian)
294{
295 EXPECT_TRUE(approx_equal(polar.get_r(), 5.0));
296}
297
298TEST_F(PolarPointTest, ConversionToCartesian)
299{
300 Point back(polar);
301 EXPECT_TRUE(approx_equal(back.get_x(), 3.0));
302 EXPECT_TRUE(approx_equal(back.get_y(), 4.0));
303}
304
305TEST_F(PolarPointTest, RoundTripConversion)
306{
307 Point original{7, 11};
308 Polar_Point polar_form{original};
309 Point back{polar_form};
310
311 EXPECT_TRUE(approx_equal(back.get_x(), original.get_x()));
312 EXPECT_TRUE(approx_equal(back.get_y(), original.get_y()));
313}
314
315TEST_F(PolarPointTest, QuadrantFirst)
316{
317 Point p{1, 1};
318 Polar_Point pp{p};
319 EXPECT_EQ(pp.get_quadrant(), Polar_Point::First);
320}
321
322TEST_F(PolarPointTest, QuadrantSecond)
323{
324 Point p{-1, 1};
325 Polar_Point pp{p};
326 EXPECT_EQ(pp.get_quadrant(), Polar_Point::Second);
327}
328
329TEST_F(PolarPointTest, QuadrantThird)
330{
331 Point p{-1, -1};
332 Polar_Point pp{p};
333 EXPECT_EQ(pp.get_quadrant(), Polar_Point::Third);
334}
335
336TEST_F(PolarPointTest, QuadrantFourth)
337{
338 Point p{1, -1};
339 Polar_Point pp{p};
340 EXPECT_EQ(pp.get_quadrant(), Polar_Point::Fourth);
341}
342
344{
345 std::string str = polar.to_string();
346 EXPECT_FALSE(str.empty());
347 EXPECT_EQ(str[0], '[');
348}
349
350TEST_F(PolarPointTest, DefaultConstruction)
351{
352 Polar_Point pp;
353 EXPECT_EQ(pp.get_r(), 0);
354 EXPECT_EQ(pp.get_theta(), 0);
355}
356
357//============================================================================
358// Segment Tests
359//============================================================================
360
361class SegmentTest : public ::testing::Test
362{
363protected:
365 Point p1{1, 0};
366 Point p2{0, 1};
367 Point p3{1, 1};
368
372};
373
374TEST_F(SegmentTest, DefaultConstruction)
375{
376 Segment s;
377 // Should not crash
378}
379
380TEST_F(SegmentTest, TwoPointConstruction)
381{
382 EXPECT_EQ(horizontal.get_src_point(), origin);
383 EXPECT_EQ(horizontal.get_tgt_point(), p1);
384}
385
387{
388 Segment s1{origin, p1};
389 Segment s2{origin, p1};
390 Segment s3{origin, p2};
391
392 EXPECT_EQ(s1, s2);
393 EXPECT_NE(s1, s3);
394}
395
397{
398 Geom_Number len = horizontal.length();
399 EXPECT_TRUE(approx_equal(len, 1.0));
400
401 Segment longer{Point{0, 0}, Point{3, 4}};
402 EXPECT_TRUE(approx_equal(longer.length(), 5.0));
403}
404
406{
407 EXPECT_TRUE(approx_equal(horizontal.slope(), 0.0));
408 EXPECT_TRUE(approx_equal(diagonal.slope(), 1.0));
409}
410
412{
413 Point mid = diagonal.mid_point();
414 EXPECT_TRUE(approx_equal(mid.get_x(), 0.5));
415 EXPECT_TRUE(approx_equal(mid.get_y(), 0.5));
416}
417
418TEST_F(SegmentTest, HighestPoint)
419{
420 Segment s{Point{0, 0}, Point{1, 2}};
421 const Point & h = s.highest_point();
422 EXPECT_EQ(h.get_y(), 2);
423}
424
425TEST_F(SegmentTest, LowestPoint)
426{
427 Segment s{Point{0, 0}, Point{1, 2}};
428 const Point & l = s.lowest_point();
429 EXPECT_EQ(l.get_y(), 0);
430}
431
432TEST_F(SegmentTest, LeftmostPoint)
433{
434 Segment s{Point{2, 0}, Point{0, 1}};
435 const Point & l = s.leftmost_point();
436 EXPECT_EQ(l.get_x(), 0);
437}
438
439TEST_F(SegmentTest, RightmostPoint)
440{
441 Segment s{Point{2, 0}, Point{0, 1}};
442 const Point & r = s.rightmost_point();
443 EXPECT_EQ(r.get_x(), 2);
444}
445
446TEST_F(SegmentTest, ContainsToPoint)
447{
448 Point inside{0.5, 0.5};
449 Point outside{2, 2};
450
451 EXPECT_TRUE(diagonal.contains(inside));
452 EXPECT_FALSE(diagonal.contains(outside));
453}
454
455TEST_F(SegmentTest, IsColinearWith)
456{
457 Point colinear{0.5, 0.5};
458 Point not_colinear{0.5, 0.6};
459
460 EXPECT_TRUE(diagonal.is_colinear_with(colinear));
461 EXPECT_FALSE(diagonal.is_colinear_with(not_colinear));
462}
463
464TEST_F(SegmentTest, IsParallelWith)
465{
466 Segment s1{Point{0, 0}, Point{1, 1}};
467 Segment s2{Point{1, 0}, Point{2, 1}}; // Parallel
468 Segment s3{Point{0, 0}, Point{1, 0}}; // Not parallel
469
470 EXPECT_TRUE(s1.is_parallel_with(s2));
471 EXPECT_FALSE(s1.is_parallel_with(s3));
472}
473
474TEST_F(SegmentTest, IntersectsWith)
475{
476 Segment s1{Point{0, 0}, Point{2, 2}};
477 Segment s2{Point{0, 2}, Point{2, 0}}; // Cross
478 Segment s3{Point{3, 0}, Point{4, 0}}; // No intersection
479
480 EXPECT_TRUE(s1.intersects_with(s2));
481 EXPECT_FALSE(s1.intersects_with(s3));
482}
483
484TEST_F(SegmentTest, IntersectsProperlyWith)
485{
486 Segment s1{Point{0, 0}, Point{2, 2}};
487 Segment s2{Point{0, 2}, Point{2, 0}}; // Proper cross
488
489 EXPECT_TRUE(s1.intersects_properly_with(s2));
490}
491
492TEST_F(SegmentTest, IntersectionWith)
493{
494 Segment s1{Point{0, 0}, Point{2, 2}};
495 Segment s2{Point{0, 2}, Point{2, 0}};
496
497 Point inter = s1.intersection_with(s2);
498 EXPECT_TRUE(approx_equal(inter.get_x(), 1.0));
499 EXPECT_TRUE(approx_equal(inter.get_y(), 1.0));
500}
501
502TEST_F(SegmentTest, IntersectionWithParallelThrows)
503{
504 Segment s1{Point{0, 0}, Point{1, 1}};
505 Segment s2{Point{0, 1}, Point{1, 2}}; // Parallel
506
507 EXPECT_THROW(s1.intersection_with(s2), std::domain_error);
508}
509
511{
512 Segment s{Point{0, 0}, Point{1, 0}};
513 EXPECT_EQ(s.sense(), Segment::E);
514}
515
517{
518 Segment s{Point{1, 0}, Point{0, 0}};
519 EXPECT_EQ(s.sense(), Segment::W);
520}
521
522TEST_F(SegmentTest, SenseNorth)
523{
524 Segment s{Point{0, 0}, Point{0, 1}};
525 EXPECT_EQ(s.sense(), Segment::N);
526}
527
528TEST_F(SegmentTest, SenseSouth)
529{
530 Segment s{Point{0, 1}, Point{0, 0}};
531 EXPECT_EQ(s.sense(), Segment::S);
532}
533
534TEST_F(SegmentTest, SenseNorthEast)
535{
536 Segment s{Point{0, 0}, Point{1, 1}};
537 EXPECT_EQ(s.sense(), Segment::NE);
538}
539
540TEST_F(SegmentTest, SenseSouthWest)
541{
542 Segment s{Point{1, 1}, Point{0, 0}};
543 EXPECT_EQ(s.sense(), Segment::SW);
544}
545
546TEST_F(SegmentTest, SenseNorthWest)
547{
548 Segment s{Point{1, 0}, Point{0, 1}};
549 EXPECT_EQ(s.sense(), Segment::NW);
550}
551
552TEST_F(SegmentTest, SenseSouthEast)
553{
554 Segment s{Point{0, 1}, Point{1, 0}};
555 EXPECT_EQ(s.sense(), Segment::SE);
556}
557
559{
560 std::string str = diagonal.to_string();
561 EXPECT_FALSE(str.empty());
562}
563
565{
566 Segment s{Point{0, 0}, Point{1, 0}};
567 s.rotate(PI / 2); // Rotate 90 degrees
568
569 EXPECT_TRUE(approx_equal(s.get_tgt_point().get_x(), 0.0, 1e-6));
570 EXPECT_TRUE(approx_equal(s.get_tgt_point().get_y(), 1.0, 1e-6));
571}
572
573TEST_F(SegmentTest, GetPerpendicular)
574{
575 Segment s{Point{0, 0}, Point{2, 0}};
576 Point p{1, 1};
577
578 Segment perp = s.get_perpendicular(p);
579 // Perpendicular from (1,1) to horizontal line should hit (1,0)
580 EXPECT_TRUE(approx_equal(perp.get_src_point().get_x(), 1.0, 1e-6));
581 EXPECT_TRUE(approx_equal(perp.get_src_point().get_y(), 0.0, 1e-6));
582}
583
584TEST_F(SegmentTest, CounterclockwiseAngle)
585{
586 Segment s{Point{0, 0}, Point{1, 0}};
587 double angle = s.counterclockwise_angle();
588 EXPECT_TRUE(approx_equal(angle, 0.0, 1e-6));
589}
590
591//============================================================================
592// Triangle Tests
593//============================================================================
594
595class TriangleTest : public ::testing::Test
596{
597protected:
598 Point p1{0, 0};
599 Point p2{4, 0};
600 Point p3{0, 3};
602};
603
604TEST_F(TriangleTest, ThreePointConstruction)
605{
606 EXPECT_EQ(t.get_p1(), p1);
607 EXPECT_EQ(t.get_p2(), p2);
608 EXPECT_EQ(t.get_p3(), p3);
609}
610
611TEST_F(TriangleTest, ConstructionFromPointAndSegment)
612{
613 Segment s{p2, p3};
614 Triangle t2{p1, s};
615
616 EXPECT_EQ(t2.get_p1(), p1);
617}
618
619TEST_F(TriangleTest, ConstructionFromSegmentAndPoint)
620{
621 Segment s{p1, p2};
622 Triangle t2{s, p3};
623
624 EXPECT_EQ(t2.get_p3(), p3);
625}
626
627TEST_F(TriangleTest, CollinearPointsThrow)
628{
629 Point a{0, 0};
630 Point b{1, 1};
631 Point c{2, 2};
632
633 EXPECT_THROW(Triangle(a, b, c), std::domain_error);
634}
635
637{
638 // 3-4-5 right triangle has area = (1/2)*3*4 = 6
639 Geom_Number area = t.area();
640 EXPECT_EQ(area, 6);
641}
642
644{
645 Point inside{1, 1};
646 Point outside{5, 5};
647
648 EXPECT_TRUE(t.contains(inside));
649 EXPECT_FALSE(t.contains(outside));
650}
651
652TEST_F(TriangleTest, HighestPoint)
653{
654 const Point & h = t.highest_point();
655 EXPECT_EQ(h.get_y(), 3);
656}
657
658TEST_F(TriangleTest, LowestPoint)
659{
660 const Point & l = t.lowest_point();
661 EXPECT_EQ(l.get_y(), 0);
662}
663
664TEST_F(TriangleTest, LeftmostPoint)
665{
666 const Point & l = t.leftmost_point();
667 EXPECT_EQ(l.get_x(), 0);
668}
669
670TEST_F(TriangleTest, RightmostPoint)
671{
672 const Point & r = t.rightmost_point();
673 EXPECT_EQ(r.get_x(), 4);
674}
675
676TEST_F(TriangleTest, IsClockwise)
677{
678 // Counter-clockwise triangle
679 Triangle ccw{Point{0,0}, Point{1,0}, Point{0,1}};
680
681 // Clockwise triangle
682 Triangle cw{Point{0,0}, Point{0,1}, Point{1,0}};
683
684 // Note: the is_clockwise check depends on sign of area
685 EXPECT_NE(ccw.is_clockwise(), cw.is_clockwise());
686}
687
688//============================================================================
689// Rectangle Tests
690//============================================================================
691
692class RectangleTest : public ::testing::Test
693{
694protected:
695 Rectangle r{0, 0, 4, 3};
696};
697
698// They allocate the numbers that they give, so they may throw
699static_assert(not noexcept(std::declval<const Rectangle &>().width()));
700static_assert(not noexcept(std::declval<const Rectangle &>().height()));
701static_assert(not noexcept(std::declval<const Rectangle &>().area()));
702static_assert(not noexcept(std::declval<const Rectangle &>().perimeter()));
703static_assert(not noexcept(std::declval<const Rectangle &>().center()));
704static_assert(not noexcept(std::declval<const Rectangle &>().corners()));
705static_assert(not noexcept(std::declval<const Rectangle &>()
706 .distance_squared_to(std::declval<const Point &>())));
707
708TEST_F(RectangleTest, DefaultConstruction)
709{
710 Rectangle r_default;
711 EXPECT_EQ(r_default.get_xmin(), 0);
712 EXPECT_EQ(r_default.get_ymin(), 0);
713 EXPECT_EQ(r_default.get_xmax(), 0);
714 EXPECT_EQ(r_default.get_ymax(), 0);
715}
716
717TEST_F(RectangleTest, ParameterizedConstruction)
718{
719 EXPECT_EQ(r.get_xmin(), 0);
720 EXPECT_EQ(r.get_ymin(), 0);
721 EXPECT_EQ(r.get_xmax(), 4);
722 EXPECT_EQ(r.get_ymax(), 3);
723}
724
725TEST_F(RectangleTest, InvalidRectangleThrows)
726{
727 EXPECT_THROW(Rectangle(4, 0, 0, 3), std::range_error); // xmax < xmin
728 EXPECT_THROW(Rectangle(0, 3, 4, 0), std::range_error); // ymax < ymin
729}
730
732{
733 EXPECT_EQ(r.width(), 4);
734}
735
737{
738 EXPECT_EQ(r.height(), 3);
739}
740
742{
743 Point inside{2, 1};
744 Point outside{5, 5};
745 Point on_edge{0, 0};
746
747 EXPECT_TRUE(r.contains(inside));
748 EXPECT_FALSE(r.contains(outside));
749 EXPECT_TRUE(r.contains(on_edge));
750}
751
753{
754 Rectangle r2{2, 1, 6, 4}; // Overlaps
755 Rectangle r3{5, 5, 6, 6}; // No overlap
756
757 EXPECT_TRUE(r.intersects(r2));
758 EXPECT_FALSE(r.intersects(r3));
759}
760
761TEST_F(RectangleTest, DistanceSquaredTo)
762{
763 Point inside{2, 1};
764 Point outside{5, 0}; // Distance 1 from right edge
765
766 EXPECT_EQ(r.distance_squared_to(inside), 0);
767 EXPECT_EQ(r.distance_squared_to(outside), 1);
768}
769
771{
772 Point outside{5, 0};
773 Geom_Number dist = r.distance_to(outside);
774 EXPECT_TRUE(approx_equal(dist, 1.0));
775}
776
778{
779 Rectangle r_mod;
780 r_mod.set_rect(1, 2, 3, 4);
781
782 EXPECT_EQ(r_mod.get_xmin(), 1);
783 EXPECT_EQ(r_mod.get_ymin(), 2);
784 EXPECT_EQ(r_mod.get_xmax(), 3);
785 EXPECT_EQ(r_mod.get_ymax(), 4);
786}
787
788TEST_F(RectangleTest, SetRectInvalidThrows)
789{
790 Rectangle r_mod;
791 EXPECT_THROW(r_mod.set_rect(3, 2, 1, 4), std::range_error);
792}
793
794//============================================================================
795// Ellipse Tests
796//============================================================================
797
798class EllipseTest : public ::testing::Test
799{
800protected:
802 Ellipse circle{center, 1, 1}; // Unit circle
803 Ellipse ellipse{center, 2, 1}; // Horizontal ellipse
804};
805
806TEST_F(EllipseTest, DefaultConstruction)
807{
808 Ellipse e;
809 // Should not crash
810}
811
812TEST_F(EllipseTest, ParameterizedConstruction)
813{
814 EXPECT_EQ(ellipse.get_center(), center);
815 EXPECT_EQ(ellipse.get_hradius(), 2);
816 EXPECT_EQ(ellipse.get_vradius(), 1);
817}
818
819TEST_F(EllipseTest, CopyConstruction)
820{
821 Ellipse e2{ellipse};
822 EXPECT_EQ(e2.get_center(), ellipse.get_center());
823 EXPECT_EQ(e2.get_hradius(), ellipse.get_hradius());
824 EXPECT_EQ(e2.get_vradius(), ellipse.get_vradius());
825}
826
827TEST_F(EllipseTest, HighestPoint)
828{
829 Point h = ellipse.highest_point();
830 EXPECT_EQ(h.get_x(), 0);
831 EXPECT_EQ(h.get_y(), 1);
832}
833
834TEST_F(EllipseTest, LowestPoint)
835{
836 Point l = ellipse.lowest_point();
837 EXPECT_EQ(l.get_x(), 0);
838 EXPECT_EQ(l.get_y(), -1);
839}
840
841TEST_F(EllipseTest, LeftmostPoint)
842{
843 Point l = ellipse.leftmost_point();
844 EXPECT_EQ(l.get_x(), -2);
845 EXPECT_EQ(l.get_y(), 0);
846}
847
848TEST_F(EllipseTest, RightmostPoint)
849{
850 Point r = ellipse.rightmost_point();
851 EXPECT_EQ(r.get_x(), 2);
852 EXPECT_EQ(r.get_y(), 0);
853}
854
855TEST_F(EllipseTest, ContainsToCenter)
856{
857 EXPECT_TRUE(circle.contains(center));
858}
859
860TEST_F(EllipseTest, ContainsToInside)
861{
862 Point inside{0.5, 0.5};
863 EXPECT_TRUE(circle.contains(inside));
864}
865
866TEST_F(EllipseTest, ContainsToOutside)
867{
868 Point outside{2, 2};
869 EXPECT_FALSE(circle.contains(outside));
870}
871
872TEST_F(EllipseTest, ContainsToOnBorder)
873{
874 Point on_border{1, 0};
875 EXPECT_TRUE(circle.contains(on_border));
876}
877
878TEST_F(EllipseTest, IntersectsWithPointOnBorder)
879{
880 Point on_border{1, 0};
881 EXPECT_TRUE(circle.intersects_with(on_border));
882}
883
884TEST_F(EllipseTest, IsClockwise)
885{
886 EXPECT_FALSE(Ellipse::is_clockwise());
887}
888
889TEST_F(EllipseTest, PointIsInsideEllipse)
890{
891 Point inside{0.5, 0};
892 EXPECT_TRUE(inside.is_inside(circle));
893}
894
895TEST_F(EllipseTest, VerticalSegmentOutsideYRangeDoesNotIntersect)
896{
897 Ellipse e(Point(0, 0), 5, 3);
898 Segment vertical_far(Point(0, 10), Point(0, 20));
899 EXPECT_FALSE(e.intersects_with(vertical_far));
900}
901
902TEST_F(EllipseTest, SegmentThroughCenterIntersectionStable)
903{
904 Ellipse e(Point(0, 0), 5, 3);
905 Segment horizontal(Point(-10, 0), Point(10, 0));
906 Segment inter = e.intersection_with(horizontal);
907
908 EXPECT_TRUE(approx_equal(inter.get_src_point().get_y(), Geom_Number(0), 1e-8));
909 EXPECT_TRUE(approx_equal(inter.get_tgt_point().get_y(), Geom_Number(0), 1e-8));
910 EXPECT_TRUE(approx_equal(inter.get_src_point().get_x(), Geom_Number(-5), 1e-8));
911 EXPECT_TRUE(approx_equal(inter.get_tgt_point().get_x(), Geom_Number(5), 1e-8));
912}
913
914TEST_F(EllipseTest, SegmentClippingUsesClosedFilledRegion)
915{
916 Ellipse e(Point(0, 0), 5, 3);
917
918 const Segment inside(Point(-1, 0), Point(1, 0));
919 EXPECT_TRUE(e.intersects_with(inside));
920 EXPECT_EQ(e.intersection_with(inside), inside);
921
922 const Segment leaving(Point(0, 0), Point(10, 0));
923 EXPECT_TRUE(e.intersects_with(leaving));
924 const Segment leaving_clip = e.intersection_with(leaving);
925 EXPECT_EQ(leaving_clip.get_src_point(), Point(0, 0));
926 EXPECT_EQ(leaving_clip.get_tgt_point(), Point(5, 0));
927
928 const Segment entering(Point(10, 0), Point(0, 0));
929 const Segment entering_clip = e.intersection_with(entering);
930 EXPECT_EQ(entering_clip.get_src_point(), Point(5, 0));
931 EXPECT_EQ(entering_clip.get_tgt_point(), Point(0, 0));
932
933 const Segment tangent(Point(-10, 3), Point(10, 3));
934 const Segment tangent_clip = e.intersection_with(tangent);
935 EXPECT_EQ(tangent_clip.get_src_point(), Point(0, 3));
936 EXPECT_EQ(tangent_clip.get_tgt_point(), Point(0, 3));
937
938 const Segment crossing(Point(-10, 0), Point(10, 0));
939 EXPECT_EQ(e.intersection_with(crossing),
940 Segment(Point(-5, 0), Point(5, 0)));
941
942 const Segment reverse_crossing(Point(10, 0), Point(-10, 0));
943 EXPECT_EQ(e.intersection_with(reverse_crossing),
944 Segment(Point(5, 0), Point(-5, 0)));
945}
946
947TEST_F(EllipseTest, DegenerateSegmentClippingDistinguishesInsideAndOutside)
948{
949 Ellipse e(Point(0, 0), 5, 3);
950 const Segment inside(Point(1, 1), Point(1, 1));
951 const Segment outside(Point(8, 8), Point(8, 8));
952
953 EXPECT_TRUE(e.intersects_with(inside));
954 EXPECT_EQ(e.intersection_with(inside), inside);
955 EXPECT_FALSE(e.intersects_with(outside));
956 EXPECT_THROW(e.intersection_with(outside), std::domain_error);
957}
958
959TEST_F(EllipseTest, ExtraEllipseApis)
960{
961 EXPECT_TRUE(approx_equal(ellipse.area(), Geom_Number(2) * Geom_Number(PI), 1e-5));
962 EXPECT_GT(ellipse.perimeter(), Geom_Number(0));
963 EXPECT_EQ(ellipse.sample(Geom_Number(0)), Point(2, 0));
964 EXPECT_FALSE(ellipse.to_string().empty());
965 EXPECT_EQ(ellipse, Ellipse(center, 2, 1));
966}
967
968//============================================================================
969// Helper Function Tests
970//============================================================================
971
972TEST(HelperFunctionTest, AreaOfParallelogram)
973{
974 Point a{0, 0};
975 Point b{1, 0};
976 Point c{0, 1};
977
978 Geom_Number area = area_of_parallelogram(a, b, c);
979 EXPECT_EQ(area, 1);
980}
981
982TEST(HelperFunctionTest, AreaOfParallelogramNegative)
983{
984 Point a{0, 0};
985 Point b{0, 1};
986 Point c{1, 0};
987
988 Geom_Number area = area_of_parallelogram(a, b, c);
989 EXPECT_EQ(area, -1);
990}
991
992TEST(HelperFunctionTest, EuclideanDistance)
993{
994 Geom_Number result = euclidean_distance(3, 4);
995 EXPECT_TRUE(approx_equal(result, 5.0));
996}
997
998TEST(HelperFunctionTest, EuclideanDistanceZero)
999{
1000 Geom_Number result = euclidean_distance(0, 0);
1001 EXPECT_TRUE(approx_equal(result, 0.0));
1002}
1003
1004TEST(HelperFunctionTest, Arctan)
1005{
1006 Geom_Number result = arctan(1);
1007 EXPECT_TRUE(approx_equal(result.get_d(), PI / 4, 1e-6));
1008}
1009
1010TEST(HelperFunctionTest, Arctan2)
1011{
1012 Geom_Number result = arctan2(1, 1);
1013 EXPECT_TRUE(approx_equal(result.get_d(), PI / 4, 1e-6));
1014}
1015
1016TEST(HelperFunctionTest, Sinus)
1017{
1018 Geom_Number result = sinus(Geom_Number(PI / 2));
1019 EXPECT_TRUE(approx_equal(result.get_d(), 1.0, 1e-6));
1020}
1021
1022TEST(HelperFunctionTest, Cosinus)
1023{
1024 Geom_Number result = cosinus(0);
1025 EXPECT_TRUE(approx_equal(result.get_d(), 1.0, 1e-6));
1026}
1027
1028TEST(HelperFunctionTest, SquareRoot)
1029{
1030 Geom_Number result = square_root(4);
1031 EXPECT_TRUE(approx_equal(result.get_d(), 2.0, 1e-6));
1032}
1033
1034TEST(HelperFunctionTest, GeomNumberToDouble)
1035{
1036 Geom_Number n{3.14159};
1037 double d = geom_number_to_double(n);
1038 EXPECT_TRUE(approx_equal(d, 3.14159, 1e-4));
1039}
1040
1041//============================================================================
1042// Text and String Utility Tests
1043//============================================================================
1044
1045TEST(TextTest, AproximateStringSizeSimple)
1046{
1047 std::string str = "hello";
1048 size_t len = approximate_string_size(str);
1049 EXPECT_EQ(len, 5);
1050}
1051
1052TEST(TextTest, AproximateStringSizeWithLatex)
1053{
1054 std::string str = "\\alpha"; // Latex command counts as 1
1055 size_t len = approximate_string_size(str);
1056 EXPECT_EQ(len, 1);
1057}
1058
1059TEST(TextTest, AproximateStringSizeWithDollarSigns)
1060{
1061 std::string str = "$x$"; // $ signs are skipped
1062 size_t len = approximate_string_size(str);
1063 EXPECT_EQ(len, 1); // Only 'x' counts
1064}
1065
1066TEST(TextTest, AproximateStringSizeWithBraces)
1067{
1068 std::string str = "{ab}";
1069 size_t len = approximate_string_size(str);
1070 EXPECT_EQ(len, 2); // Only 'a' and 'b' count
1071}
1072
1073TEST(TextTest, TextConstruction)
1074{
1075 Point p{1, 2};
1076 Text t{p, "Hello"};
1077
1078 EXPECT_EQ(t.get_point(), p);
1079 EXPECT_EQ(t.get_str(), "Hello");
1080 EXPECT_EQ(t.len(), 5);
1081}
1082
1083TEST(TextTest, TextDefaultConstruction)
1084{
1085 Text t;
1086 // Should not crash
1087}
1088
1089TEST(TextTest, TextBoundingPoints)
1090{
1091 Point p{1, 2};
1092 Text t{p, "test"};
1093
1094 EXPECT_EQ(t.highest_point(), p);
1095 EXPECT_EQ(t.lowest_point(), p);
1096 EXPECT_EQ(t.leftmost_point(), p);
1097 EXPECT_EQ(t.rightmost_point(), p);
1098}
1099
1100//============================================================================
1101// Geom_Object Tests
1102//============================================================================
1103
1104TEST(GeomObjectTest, VirtualDestructor)
1105{
1106 // Test that virtual destructor works properly
1107 Geom_Object *obj = new Point{1, 2};
1108 delete obj; // Should not crash
1109}
1110
1111//============================================================================
1112// Edge Cases and Regression Tests
1113//============================================================================
1114
1115TEST(EdgeCaseTest, VerticalSegmentSlope)
1116{
1117 Segment vertical{Point{0, 0}, Point{0, 1}};
1118 double slope = vertical.slope();
1119 EXPECT_GT(slope, 1e10); // Should be very large positive
1120}
1121
1122TEST(EdgeCaseTest, VerticalSegmentSlopeNegative)
1123{
1124 Segment vertical{Point{0, 1}, Point{0, 0}};
1125 double slope = vertical.slope();
1126 EXPECT_LT(slope, -1e10); // Should be very large negative
1127}
1128
1129TEST(EdgeCaseTest, SegmentConstructionWithSlopeAndLength)
1130{
1131 Point src{0, 0};
1132 Geom_Number slope{1}; // 45 degrees
1133 Geom_Number length{std::sqrt(2)};
1134
1135 Segment s{src, slope, length};
1136
1137 EXPECT_TRUE(approx_equal(s.length(), length, 1e-6));
1138}
1139
1140TEST(EdgeCaseTest, ParallelSegmentOffset)
1141{
1142 Segment original{Point{0, 0}, Point{2, 0}};
1143 Geom_Number dist{1};
1144
1145 Segment parallel{original, dist};
1146
1147 // Parallel segment should have same length
1148 EXPECT_TRUE(approx_equal(parallel.length(), original.length(), 1e-6));
1149}
1150
1151TEST(EdgeCaseTest, SegmentEnlargeSrc)
1152{
1153 Segment s{Point{1, 0}, Point{2, 0}};
1154 Geom_Number original_size = s.length();
1155
1156 s.enlarge_src(1);
1157
1158 // Segment should be longer now
1159 EXPECT_GT(s.length(), original_size);
1160}
1161
1162TEST(EdgeCaseTest, SegmentEnlargeTgt)
1163{
1164 Segment s{Point{0, 0}, Point{1, 0}};
1165 Geom_Number original_size = s.length();
1166
1167 s.enlarge_tgt(1);
1168
1169 // Segment should be longer now
1170 EXPECT_GT(s.length(), original_size);
1171}
1172
1173TEST(EdgeCaseTest, ZeroAreaTriangleFails)
1174{
1175 // Points on a line should fail to create a triangle
1176 EXPECT_THROW(Triangle(Point{0,0}, Point{1,1}, Point{2,2}), std::domain_error);
1177}
1178
1179TEST(EdgeCaseTest, PointOnSegment)
1180{
1181 Segment s{Point{0, 0}, Point{2, 2}};
1182 Point on_segment{1, 1};
1183
1184 EXPECT_TRUE(on_segment.is_inside(s));
1185}
1186
1187TEST(EdgeCaseTest, MidPerpendicular)
1188{
1189 Segment s{Point{0, 0}, Point{2, 0}};
1190 Segment perp = s.mid_perpendicular(1);
1191
1192 // Midpoint of perpendicular should be near midpoint of original
1193 Point mid = s.mid_point();
1194 Point perp_mid = perp.mid_point();
1195
1196 EXPECT_TRUE(approx_equal(mid.distance_to(perp_mid), 0.0, 1e-6));
1197}
1198
1199TEST(EdgeCaseTest, MidPerpendicularZeroLengthThrows)
1200{
1201 Segment s{Point{1, 1}, Point{1, 1}};
1202 EXPECT_THROW(s.mid_perpendicular(1), std::domain_error);
1203}
1204
1205//============================================================================
1206// Segment-Triangle Intersection Tests
1207//============================================================================
1208
1209TEST(SegmentTriangleTest, SegmentIntersectsTriangle)
1210{
1211 Triangle t{Point{0, 0}, Point{4, 0}, Point{2, 4}};
1212 Segment s{Point{2, -1}, Point{2, 5}}; // Vertical through triangle
1213
1214 EXPECT_TRUE(s.intersects_with(t));
1215}
1216
1217TEST(SegmentTriangleTest, SegmentDoesNotIntersectTriangle)
1218{
1219 Triangle t{Point{0, 0}, Point{4, 0}, Point{2, 4}};
1220 Segment s{Point{10, 10}, Point{11, 11}}; // Far away
1221
1222 EXPECT_FALSE(s.intersects_with(t));
1223}
1224
1225TEST(SegmentTriangleTest, SegmentClippingUsesClosedFilledRegion)
1226{
1227 const Triangle t{Point{0, 0}, Point{6, 0}, Point{0, 6}};
1228
1229 const Segment inside{Point{1, 1}, Point{2, 1}};
1230 EXPECT_TRUE(inside.intersects_with(t));
1231 EXPECT_EQ(inside.intersection_with(t), inside);
1232
1233 const Segment leaving{Point{1, 1}, Point{10, 1}};
1234 const Segment leaving_clip = leaving.intersection_with(t);
1235 EXPECT_EQ(leaving_clip.get_src_point(), Point(1, 1));
1236 EXPECT_EQ(leaving_clip.get_tgt_point(), Point(5, 1));
1237
1238 const Segment entering{Point{10, 1}, Point{1, 1}};
1239 const Segment entering_clip = entering.intersection_with(t);
1240 EXPECT_EQ(entering_clip.get_src_point(), Point(5, 1));
1241 EXPECT_EQ(entering_clip.get_tgt_point(), Point(1, 1));
1242
1243 const Segment tangent{Point{-1, 1}, Point{1, -1}};
1244 const Segment tangent_clip = tangent.intersection_with(t);
1245 EXPECT_EQ(tangent_clip.get_src_point(), Point(0, 0));
1246 EXPECT_EQ(tangent_clip.get_tgt_point(), Point(0, 0));
1247
1248 const Segment crossing{Point{-2, 2}, Point{8, 2}};
1249 EXPECT_EQ(crossing.intersection_with(t),
1250 Segment(Point(0, 2), Point(4, 2)));
1251
1252 const Segment reverse_crossing{Point{8, 2}, Point{-2, 2}};
1253 EXPECT_EQ(reverse_crossing.intersection_with(t),
1254 Segment(Point(4, 2), Point(0, 2)));
1255
1256 const Segment boundary_overlap{Point{-2, 0}, Point{8, 0}};
1257 EXPECT_EQ(boundary_overlap.intersection_with(t),
1258 Segment(Point(0, 0), Point(6, 0)));
1259
1260 const Segment reverse_boundary_overlap{Point{8, 0}, Point{-2, 0}};
1261 EXPECT_EQ(reverse_boundary_overlap.intersection_with(t),
1262 Segment(Point(6, 0), Point(0, 0)));
1263}
1264
1265TEST(SegmentTriangleTest, DegenerateSegmentClippingDistinguishesInsideAndOutside)
1266{
1267 const Triangle t{Point{0, 0}, Point{6, 0}, Point{0, 6}};
1268 const Segment inside{Point{1, 1}, Point{1, 1}};
1269 const Segment outside{Point{8, 8}, Point{8, 8}};
1270
1271 EXPECT_TRUE(inside.intersects_with(t));
1272 EXPECT_EQ(inside.intersection_with(t), inside);
1273 EXPECT_FALSE(outside.intersects_with(t));
1274 EXPECT_THROW(outside.intersection_with(t), std::domain_error);
1275}
1276
1277//============================================================================
1278// Main
1279//============================================================================
1280
1281int main(int argc, char **argv)
1282{
1283 testing::InitGoogleTest(&argc, argv);
1284 return RUN_ALL_TESTS();
1285}
int main()
long double h
Definition btreepic.C:154
An axis-aligned ellipse.
Definition point.H:2076
bool intersects_with(const Segment &s) const
Checks if a segment intersects the ellipse.
Definition point.H:2298
static bool is_clockwise()
Returns the orientation of the ellipse.
Definition point.H:2228
Segment intersection_with(const Segment &sg) const
Computes the intersection segment between a line segment and this ellipse.
Definition point.H:2391
Represents a point with rectangular coordinates in a 2D plane.
Definition point.H:221
Geom_Number norm() const
Euclidean norm (vector magnitude).
Definition point.H:393
const Geom_Number & get_x() const noexcept
Gets the x-coordinate value.
Definition point.H:448
const Geom_Number & get_y() const noexcept
Gets the y-coordinate value.
Definition point.H:457
Geom_Number distance_to(const Point &p) const
Calculates the Euclidean distance to another point.
Definition point.H:1498
const Point & highest_point() const
Returns the highest point (largest y-coordinate).
Definition point.H:679
const Point & nearest_point(const Point &p1, const Point &p2) const
Returns which of the two points, p1 or p2, is nearer to this point.
Definition point.H:607
Point rotate(const Geom_Number &angle) const
Rotates the point around the origin by a given angle.
Definition point.H:415
Point normalize() const
Returns a normalized copy of this vector (magnitude 1).
Definition point.H:403
Polar representation of a 2D point.
Definition point.H:728
const Geom_Number & get_theta() const
Gets the angle (theta) of the polar point.
Definition point.H:748
const Geom_Number & get_r() const
Gets the radius (magnitude) of the polar point.
Definition point.H:739
An axis-aligned rectangle.
Definition point.H:1789
const Geom_Number & get_xmin() const
Gets the minimum x-coordinate.
Definition point.H:1815
void set_rect(const Geom_Number &xmin, const Geom_Number &ymin, const Geom_Number &xmax, const Geom_Number &ymax)
Sets the coordinates of the rectangle.
Definition point.H:1866
const Geom_Number & get_ymax() const
Gets the maximum y-coordinate.
Definition point.H:1830
const Geom_Number & get_ymin() const
Gets the minimum y-coordinate.
Definition point.H:1820
const Geom_Number & get_xmax() const
Gets the maximum x-coordinate.
Definition point.H:1825
Represents a line segment between two points.
Definition point.H:837
Point mid_point() const
Returns the midpoint of this segment.
Definition point.H:1128
Point intersection_with(const Segment &s) const
Computes the intersection point of the infinite lines defined by two segments.
Definition point.H:1334
Segment mid_perpendicular(const Geom_Number &dist) const
Returns the perpendicular chord of a given length passing through the midpoint.
Definition point.H:1225
const Point & get_tgt_point() const noexcept
Gets the target point of the segment.
Definition point.H:933
const Point & get_src_point() const noexcept
Gets the source point of the segment.
Definition point.H:924
Segment get_perpendicular(const Point &p) const
Constructs a segment perpendicular to this that passes through point p.
Definition point.H:1203
Represents a text string positioned at a 2D point.
Definition point.H:2817
A non-degenerate triangle defined by three points.
Definition point.H:1512
Ellipse ellipse
Ellipse circle
Point origin
Definition point_test.cc:82
Polar_Point polar
Rectangle r
Segment diagonal
Segment vertical
Segment horizontal
#define TEST(name)
bool vertical
If true, use vertical layout (default).
Main namespace for Aleph-w library functions.
Geom_Number area_of_parallelogram(const Point &a, const Point &b, const Point &c)
Compute the signed area of the parallelogram defined by vectors a->b and a->c.
Definition point.H:2886
bool on_segment(const Segment &s, const Point &p)
Return true if p lies on segment s (exact).
Definition point.H:2961
Geom_Number cosinus(const Geom_Number &x)
Cosine of x (wrapper over mpfr).
Definition point.H:191
Geom_Number square_root(const Geom_Number &x)
Square root of x (wrapper over mpfr).
Definition point.H:197
double geom_number_to_double(const Geom_Number &n)
Converts a Geom_Number to its double precision representation.
Definition point.H:120
bool diff(const C1 &c1, const C2 &c2, Eq e=Eq())
Check if two containers differ.
constexpr double PI_2
Definition point.H:130
mpq_class Geom_Number
Numeric type used by the geometry module.
Definition point.H:113
Geom_Number arctan2(const Geom_Number &m, const Geom_Number &n)
Two-argument arc tangent (wrapper over mpfr).
Definition point.H:179
bool between(const Point &a, const Point &b, const Point &c)
size_t approximate_string_size(const std::string &str)
Estimate the count of printable characters in a LaTeX string.
Definition point.H:2778
Geom_Number arctan(const Geom_Number &m)
Arc tangent of m (wrapper over mpfr).
Definition point.H:173
Geom_Number euclidean_distance(const Geom_Number &x, const Geom_Number &y)
Euclidean distance (hypotenuse) of the vector (x, y).
Definition point.H:160
constexpr double PI
Definition point.H:129
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
Geom_Number sinus(const Geom_Number &x)
Sine of x (wrapper over mpfr).
Definition point.H:185
2D point and geometric utilities.
constexpr double EPSILON
Definition point_test.cc:61
TEST_F(PointTest, DefaultConstruction)
Definition point_test.cc:88
bool approx_equal(const Geom_Number &a, const Geom_Number &b, double tol=EPSILON)
Definition point_test.cc:64
Base class for all geometric objects.
Definition point.H:206
Gsl_Compatible_Rng r
DynList< int > l