• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NREL / SolTrace / 21006557699

14 Jan 2026 07:09PM UTC coverage: 88.001% (+0.2%) from 87.815%
21006557699

Pull #96

github

web-flow
Merge 2d2b811d6 into e78d2bfb0
Pull Request #96: 95 implement embree runner

569 of 752 new or added lines in 16 files covered. (75.66%)

13 existing lines in 6 files now uncovered.

6241 of 7092 relevant lines covered (88.0%)

7203590.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.19
/coretrace/simulation_data/aperture.hpp
1
/**
2
 * @file aperture.hpp
3
 * @brief Aperture geometry definitions and implementations
4
 *
5
 * Defines various aperture shapes (rectangular, circular, annular, etc.) used to
6
 * limit the active area of optical elements in ray tracing simulations.
7
 * Apertures determine which rays are accepted or rejected by optical surfaces.
8
 *
9
 * @defgroup apertures Aperture Geometries
10
 * @{
11
 */
12

13
#ifndef SOLTRACE_APERTURE_H
14
#define SOLTRACE_APERTURE_H
15

16
#include <cmath>
17
#include <memory>
18
#include <vector>
19
#include <nlohmann/json.hpp>
20

21
#include "constants.hpp"
22

23
namespace SolTrace::Data
24
{
25

26
    // TODO: For apertures that do not include the origin, should the
27
    // "circumscribing" circle be centered at the origin? Or should it
28
    // be the actual circumscribed circle.
29

30
    // Add to ApertureTypeMap when adding to ApertureType
31
    enum ApertureType
32
    {
33
        ANNULUS,
34
        CIRCLE,
35
        HEXAGON,
36
        RECTANGLE,
37
        EQUILATERAL_TRIANGLE,
38
        SINGLE_AXIS_CURVATURE_SECTION,
39
        IRREGULAR_TRIANGLE,
40
        IRREGULAR_QUADRILATERAL,
41
        APERTURE_UNKNOWN
42
    };
43

44
    inline const std::map<ApertureType, std::string> ApertureTypeMap =
45
        {
46
            {ApertureType::ANNULUS, "ANNULUS"},
47
            {ApertureType::CIRCLE, "CIRCLE"},
48
            {ApertureType::HEXAGON, "HEXAGON"},
49
            {ApertureType::RECTANGLE, "RECTANGLE"},
50
            {ApertureType::EQUILATERAL_TRIANGLE, "EQUILATERAL_TRIANGLE"},
51
            {ApertureType::SINGLE_AXIS_CURVATURE_SECTION, "SINGLE_AXIS_CURVATURE_SECTION"},
52
            {ApertureType::IRREGULAR_TRIANGLE, "IRREGULAR_TRIANGLE"},
53
            {ApertureType::IRREGULAR_QUADRILATERAL, "IRREGULAR_QUADRILATERAL"},
54
            {ApertureType::APERTURE_UNKNOWN, "APERTURE_UNKNOWN"}};
55

56
    struct Aperture;
57
    using aperture_ptr = std::shared_ptr<Aperture>;
58

59
    /**
60
     * @brief Factory function to create aperture objects
61
     * @tparam A Aperture type to create
62
     * @tparam Args Constructor argument types
63
     * @param args Constructor arguments
64
     * @return Shared pointer to the created aperture
65
     */
66
    template <typename A, typename... Args>
67
    inline auto make_aperture(Args &&...args)
40,701✔
68
    {
69
        return std::make_shared<A>(std::forward<Args>(args)...);
40,701✔
70
    }
71

72
    struct Aperture
73
    {
74
    public:
75
        ApertureType my_type;
76

77
        /**
78
         * @brief Constructor for base aperture
79
         * @param type The aperture type enumeration
80
         */
81
        Aperture(ApertureType type) : my_type(type) {}
6,621✔
82

83
        virtual ~Aperture() {}
19,299✔
84

85
        /**
86
         * @brief Factory method to create apertures from type and parameters
87
         * @param type The aperture type to create
88
         * @param args Vector of parameters for the aperture
89
         * @return Shared pointer to the created aperture
90
         */
91
        static aperture_ptr make_aperture_from_type(ApertureType type,
92
                                                    const std::vector<double> &args);
93

94
        /**
95
         * @brief Factory method to create apertures from json
96
         * @param jnode the json containing necessary parameters for each aperture type
97
         * @return Shared pointer to the created aperture
98
         */
99
        static aperture_ptr make_aperture_from_json(const nlohmann::ordered_json &jnode);
100

101
        /**
102
         * @brief Get the aperture type
103
         * @return The aperture type enumeration
104
         */
105
        inline ApertureType get_type() const
106
        {
107
            return my_type;
108
        }
109

110
        /**
111
         * @brief Get radius of circumscribed circle
112
         * @return Radius of the smallest circle that contains the aperture
113
         */
114
        virtual inline double radius_circumscribed_circle() const
297,142✔
115
        {
116
            return 0.5 * this->diameter_circumscribed_circle();
297,142✔
117
        }
118

119
        /**
120
         * @brief Calculate the aperture area
121
         * @return Area of the aperture in square units
122
         */
123
        virtual double aperture_area() const = 0;
124

125
        /**
126
         * @brief Get diameter of circumscribed circle
127
         * @return Diameter of the smallest circle that contains the aperture
128
         */
129
        virtual double diameter_circumscribed_circle() const = 0;
130

131
        /**
132
         * @brief Triangulate the aperture shape
133
         * @return Tuple of 2D vertices and triangle indices
134
         */
135
        virtual std::tuple<std::vector<double>, std::vector<int>>
136
        triangulation() const = 0;
137

138
        /**
139
         * @brief Test if a point is inside the aperture
140
         * @param x X coordinate of the test point
141
         * @param y Y coordinate of the test point
142
         * @return True if point is inside aperture, false otherwise
143
         */
144
        virtual bool is_in(double x, double y) const = 0;
145

146
        /**
147
         * @brief Create a copy of this aperture
148
         * @return Shared pointer to a copy of this aperture
149
         */
150
        virtual aperture_ptr make_copy() const = 0;
151

152
        virtual void bounding_box(double &xmin, double &xmax,
153
                                  double &ymin, double &ymax) const = 0;
154

155
        /**
156
         * @brief Write aperture parameters to json
157
         * @param jnode JSON node
158
         */
159
        virtual void write_json(nlohmann::ordered_json &jnode) const = 0;
160

161
        /**
162
         * @brief Get the aperture type string
163
         * @return The aperture type string
164
         */
165
        inline std::string get_type_string() const
166
        {
167
            switch (my_type)
168
            {
169
            case ANNULUS:
170
                return "Annulus";
171
            case CIRCLE:
172
                return "Circle";
173
            case HEXAGON:
174
                return "Hexagon";
175
            case RECTANGLE:
176
                return "Rectangle";
177
            case EQUILATERAL_TRIANGLE:
178
                return "Regular Triangle";
179
            case SINGLE_AXIS_CURVATURE_SECTION:
180
                return "Single Axis Curvature";
181
            case IRREGULAR_TRIANGLE:
182
                return "Triangle";
183
            case IRREGULAR_QUADRILATERAL:
184
                return "Quad";
185
            case APERTURE_UNKNOWN:
186
                return "Unknown";
187
            }
188
            return "Unknown";
189
        }
190

191
    protected:
192
        struct Point
193
        {
194
        public:
195
            double x;
196
            double y;
NEW
197
            Point(double ix, double iy) : x(ix), y(iy) {}
×
NEW
198
            bool operator==(const Point &p) const
×
199
            {
UNCOV
200
                return x == p.x && y == p.y;
×
201
            }
202
        };
203
        struct Triangle
204
        {
205
        public:
206
            Point a;
207
            Point b;
208
            Point c;
NEW
209
            Triangle(Point ia, Point ib, Point ic) : a(ia), b(ib), c(ic) {}
×
210
        };
211
        /**
212
         * @brief Compute the mipoint between to points
213
         * @return The midpoint
214
         */
215
        Point midpoint(const Point &v0, const Point &v1) const;
216
        /**
217
         * @brief Recursively Subdivide a triangle by midpoints
218
         * @param tri The triangle to subdivide
219
         * @param n number of subdivisions
220
         * @return vector of triangles
221
         */
222
        std::vector<Triangle> subdivide(Triangle tri, int n) const;
223
        /**
224
         * @brief Return the index of the point in the vector, adding if it
225
         * doesn't exist
226
         * @param v The vector of points
227
         * @param p The point of interest
228
         * @return index of p in v
229
         */
230
        int index_of(std::vector<Point> &v, const Point &p) const;
231
        /**
232
         * @brief Convert a list of Triangles in indexed (flattened) faceset
233
         * @param triangles The list to convert
234
         * @return indexed faceset
235
         */
236
        std::tuple<std::vector<double>, std::vector<int>>
237
        indexed_triangles(const std::vector<Triangle> &triangles) const;
238
    };
239

240
    struct Annulus : public Aperture
241
    {
242
        double inner_radius;
243
        double outer_radius;
244
        double arc_angle;
245

246
        // Annulus()
247
        //     : Aperture(ANNULUS),
248
        //       inner_radius(0.0), outer_radius(0.0), arc_angle(0.0)
249
        // {
250
        // }
251

252
        /**
253
         * @brief Constructor for annulus aperture
254
         * @param ri Inner radius of the annulus
255
         * @param ro Outer radius of the annulus
256
         * @param arc Arc angle in radians (2*pi for full annulus)
257
         */
258
        Annulus(double ri, double ro, double arc)
21✔
259
            : Aperture(ApertureType::ANNULUS),
21✔
260
              inner_radius(ri),
21✔
261
              outer_radius(ro),
21✔
262
              arc_angle(arc)
21✔
263
        {
264
        }
21✔
265

266
        /**
267
         * @brief Json-based constructor for annulus aperture
268
         * @param jnode contains ri, ro, and arc angle
269
         */
270
        Annulus(const nlohmann::ordered_json &jnode);
271

272
        virtual ~Annulus() {}
28✔
273

274
        /**
275
         * @brief Calculate annulus aperture area
276
         * @return Area of the annular aperture
277
         */
278
        virtual double aperture_area() const override;
279

280
        /**
281
         * @brief Get diameter of circumscribed circle for annulus
282
         * @return Diameter of outer circle
283
         */
284
        virtual double diameter_circumscribed_circle() const override;
285

286
        virtual void bounding_box(double &xmin,
287
                                  double &xmax,
288
                                  double &ymin,
289
                                  double &ymax) const override;
290

291
        /**
292
         * @brief Test if point is inside annulus aperture
293
         * @param x X coordinate
294
         * @param y Y coordinate
295
         * @return True if point is within annular region
296
         */
297
        virtual bool is_in(double x, double y) const override;
298

299
        /**
300
         * @brief Create copy of annulus aperture
301
         * @return Shared pointer to annulus copy
302
         */
303
        virtual aperture_ptr make_copy() const override;
304

305
        /**
306
         * @brief Write aperture parameters to json
307
         * @param jnode JSON node
308
         */
309
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
310

311
        /**
312
         * @brief Triangulate the annulus shape
313
         * @return Tuple of 2D vertices and triangle indices
314
         */
315
        virtual std::tuple<std::vector<double>, std::vector<int>>
316
        triangulation() const override;
317
    };
318

319
    struct Circle : public Aperture
320
    {
321
        double diameter;
322

323
        // Circle() : Aperture(CIRCLE), diameter(0.0) {}
324

325
        /**
326
         * @brief Constructor for circular aperture
327
         * @param d Diameter of the circle
328
         */
329
        Circle(double d) : Aperture(ApertureType::CIRCLE), diameter(d) {}
6✔
330

331
        /**
332
         * @brief Json-based constructor for circular aperture
333
         * @param jnode contains diameter
334
         */
335
        Circle(const nlohmann::ordered_json &jnode);
336

337
        virtual ~Circle() {}
98✔
338

339
        /**
340
         * @brief Calculate circular aperture area
341
         * @return Area of the circular aperture
342
         */
343
        virtual double aperture_area() const override;
344

345
        /**
346
         * @brief Get diameter of circumscribed circle for circle
347
         * @return Circle diameter (same as aperture diameter)
348
         */
349
        virtual double diameter_circumscribed_circle() const override;
350

351
        virtual void bounding_box(double &xmin,
352
                                  double &xmax,
353
                                  double &ymin,
354
                                  double &ymax) const override;
355

356
        /**
357
         * @brief Test if point is inside circular aperture
358
         * @param x X coordinate
359
         * @param y Y coordinate
360
         * @return True if point is within circle
361
         */
362
        virtual bool is_in(double x, double y) const override;
363

364
        /**
365
         * @brief Create copy of circular aperture
366
         * @return Shared pointer to circle copy
367
         */
368
        virtual aperture_ptr make_copy() const override;
369

370
        /**
371
         * @brief Write aperture parameters to json
372
         * @param jnode JSON node
373
         */
374
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
375

376
        /**
377
         * @brief Triangulate the circle shape
378
         * @return Tuple of 2D vertices and triangle indices
379
         */
380
        virtual std::tuple<std::vector<double>, std::vector<int>>
381
        triangulation() const override;
382
    };
383

384
    struct EqualateralTriangle : public Aperture
385
    {
386
        double circumscribe_diameter;
387
        // EqualateralTriangle() : Aperture(EQUILATERAL_TRIANGLE),
388
        //                         circumscribe_diameter(0.0)
389
        // {
390
        // }
391

392
        /**
393
         * @brief Constructor for equilateral triangle aperture
394
         * @param cd Diameter of circumscribed circle
395
         */
396
        EqualateralTriangle(double cd)
×
397
            : Aperture(ApertureType::EQUILATERAL_TRIANGLE),
×
398
              circumscribe_diameter(cd)
×
399
        {
400
        }
×
401

402
        /**
403
         * @brief Json-based constructor for equilateral triangle aperture
404
         * @param jnode contains diameter of circumscribed circle
405
         */
406
        EqualateralTriangle(const nlohmann::ordered_json &jnode);
407

408
        virtual ~EqualateralTriangle() {}
6✔
409

410
        /**
411
         * @brief Calculate equilateral triangle aperture area
412
         * @return Area of the triangular aperture
413
         */
414
        virtual double aperture_area() const override;
415

416
        /**
417
         * @brief Get diameter of circumscribed circle for triangle
418
         * @return Diameter of circumscribed circle
419
         */
420
        virtual double diameter_circumscribed_circle() const override;
421

422
        virtual void bounding_box(double &xmin,
423
                                  double &xmax,
424
                                  double &ymin,
425
                                  double &ymax) const override;
426

427
        /**
428
         * @brief Test if point is inside triangular aperture
429
         * @param x X coordinate
430
         * @param y Y coordinate
431
         * @return True if point is within triangle
432
         */
433
        virtual bool is_in(double x, double y) const override;
434

435
        /**
436
         * @brief Create copy of triangular aperture
437
         * @return Shared pointer to triangle copy
438
         */
439
        virtual aperture_ptr make_copy() const override;
440

441
        /**
442
         * @brief Write aperture parameters to json
443
         * @param jnode JSON node
444
         */
445
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
446

447
        /**
448
         * @brief Triangulate the triangle shape
449
         * @return Tuple of 2D vertices and triangle indices
450
         */
451
        virtual std::tuple<std::vector<double>, std::vector<int>>
452
        triangulation() const override;
453
    };
454

455
    struct Hexagon : public Aperture
456
    {
457
        double circumscribe_diameter;
458

459
        // Hexagon() : Aperture(HEXAGON), circumscribe_diameter(0.0) {}
460

461
        /**
462
         * @brief Constructor for hexagonal aperture
463
         * @param d Diameter of circumscribed circle
464
         */
465
        Hexagon(double d)
25✔
466
            : Aperture(ApertureType::HEXAGON),
25✔
467
              circumscribe_diameter(d) {}
25✔
468

469
        /**
470
         * @brief Json-based constructor for hexagonal aperture
471
         * @param jnode contains diameter of circumscribed circle
472
         */
473
        Hexagon(const nlohmann::ordered_json &jnode);
474

475
        virtual ~Hexagon() {}
134✔
476

477
        /**
478
         * @brief Calculate hexagonal aperture area
479
         * @return Area of the hexagonal aperture
480
         */
481
        virtual double aperture_area() const override;
482

483
        /**
484
         * @brief Get diameter of circumscribed circle for hexagon
485
         * @return Diameter of circumscribed circle
486
         */
487
        virtual double diameter_circumscribed_circle() const override;
488

489
        virtual void bounding_box(double &xmin,
490
                                  double &xmax,
491
                                  double &ymin,
492
                                  double &ymax) const override;
493

494
        /**
495
         * @brief Test if point is inside hexagonal aperture
496
         * @param x X coordinate
497
         * @param y Y coordinate
498
         * @return True if point is within hexagon
499
         */
500
        virtual bool is_in(double x, double y) const override;
501

502
        /**
503
         * @brief Create copy of hexagonal aperture
504
         * @return Shared pointer to hexagon copy
505
         */
506
        virtual aperture_ptr make_copy() const override;
507

508
        /**
509
         * @brief Write aperture parameters to json
510
         * @param jnode JSON node
511
         */
512
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
513

514
        /**
515
         * @brief Triangulate the hexagon shape
516
         * @return Tuple of 2D vertices and triangle indices
517
         */
518
        virtual std::tuple<std::vector<double>, std::vector<int>>
519
        triangulation() const override;
520
    };
521

522
    struct Rectangle : public Aperture
523
    {
524
        double x_length;
525
        double y_length;
526
        // NOTE: The point (x_coord, y_coord) gives the location of the
527
        // lower left hand corner of the rectangle in the xy-plane.
528
        double x_coord;
529
        double y_coord;
530

531
        /**
532
         * @brief Constructor for centered rectangular aperture
533
         * @param xlen Length in x direction
534
         * @param ylen Length in y direction
535
         */
536
        Rectangle(double xlen, double ylen);
537

538
        /**
539
         * @brief Constructor for positioned rectangular aperture
540
         * @param xlen Length in x direction
541
         * @param ylen Length in y direction
542
         * @param xl X coordinate of lower-left corner
543
         * @param yl Y coordinate of lower-left corner
544
         */
545
        Rectangle(double xlen, double ylen, double xl, double yl);
546

547
        /**
548
         * @brief Json-based constructor for rectangular aperture
549
         * @param jnode contains xlen, ylen, xl, yl
550
         */
551
        Rectangle(const nlohmann::ordered_json &jnode);
552

553
        virtual ~Rectangle() {}
23,959✔
554

555
        /**
556
         * @brief Calculate rectangular aperture area
557
         * @return Area of the rectangular aperture
558
         */
559
        virtual double aperture_area() const override;
560

561
        /**
562
         * @brief Get diameter of circumscribed circle for rectangle
563
         * @return Diagonal length of rectangle
564
         */
565
        virtual double diameter_circumscribed_circle() const override;
566

567
        virtual void bounding_box(double &xmin,
568
                                  double &xmax,
569
                                  double &ymin,
570
                                  double &ymax) const override;
571

572
        /**
573
         * @brief Test if point is inside rectangular aperture
574
         * @param x X coordinate
575
         * @param y Y coordinate
576
         * @return True if point is within rectangle bounds
577
         */
578
        virtual bool is_in(double x, double y) const override;
579

580
        /**
581
         * @brief Create copy of rectangular aperture
582
         * @return Shared pointer to rectangle copy
583
         */
584
        virtual aperture_ptr make_copy() const override;
585

586
        /**
587
         * @brief Write aperture parameters to json
588
         * @param jnode JSON node
589
         */
590
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
591

592
        /**
593
         * @brief Triangulate the rectangle shape
594
         * @return Tuple of 2D vertices and triangle indices
595
         */
596
        virtual std::tuple<std::vector<double>, std::vector<int>>
597
        triangulation() const override;
598
    };
599

600
    // struct SingleAxisCurvatureSection : public Aperture
601
    // {
602
    //     // TODO: Implement this?
603
    // };
604

605
    struct IrregularTriangle : public Aperture
606
    {
607
        // Locations of the 3 vertices
608
        double x1;
609
        double y1;
610
        double x2;
611
        double y2;
612
        double x3;
613
        double y3;
614

615
        /**
616
         * @brief Constructor for irregular triangle aperture
617
         * @param x1 X coordinate of vertex 1
618
         * @param y1 Y coordinate of vertex 1
619
         * @param x2 X coordinate of vertex 2
620
         * @param y2 Y coordinate of vertex 2
621
         * @param x3 X coordinate of vertex 3
622
         * @param y3 Y coordinate of vertex 3
623
         */
624
        IrregularTriangle(double x1, double y1,
625
                          double x2, double y2,
626
                          double x3, double y3);
627

628
        /**
629
         * @brief Json-based constructor for irregular triangle aperture
630
         * @param jnode contains x1, y1, x2, y2, x3, y3
631
         */
632
        IrregularTriangle(const nlohmann::ordered_json &jnode);
633

634
        ~IrregularTriangle() {}
6✔
635

636
        /**
637
         * @brief Calculate irregular triangle aperture area
638
         * @return Area of the triangular aperture
639
         */
640
        virtual double aperture_area() const override;
641

642
        /**
643
         * @brief Get diameter of circumscribed circle for triangle
644
         * @return Diameter of smallest circle containing triangle
645
         */
646
        virtual double diameter_circumscribed_circle() const override;
647

648
        virtual void bounding_box(double &xmin,
649
                                  double &xmax,
650
                                  double &ymin,
651
                                  double &ymax) const override;
652

653
        /**
654
         * @brief Test if point is inside irregular triangle
655
         * @param x X coordinate
656
         * @param y Y coordinate
657
         * @return True if point is within triangle
658
         */
659
        virtual bool is_in(double x, double y) const override;
660

661
        /**
662
         * @brief Create copy of irregular triangle aperture
663
         * @return Shared pointer to triangle copy
664
         */
665
        virtual aperture_ptr make_copy() const override;
666

667
        /**
668
         * @brief Write aperture parameters to json
669
         * @param jnode JSON node
670
         */
671
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
672

673
        /**
674
         * @brief Triangulate the triangle shape
675
         * @return Tuple of 2D vertices and triangle indices
676
         */
677
        virtual std::tuple<std::vector<double>, std::vector<int>>
678
        triangulation() const override;
679
    };
680

681
    struct IrregularQuadrilateral : public Aperture
682
    {
683
        // Locations of the 4 vertices
684
        double x1;
685
        double y1;
686
        double x2;
687
        double y2;
688
        double x3;
689
        double y3;
690
        double x4;
691
        double y4;
692

693
        /**
694
         * @brief Constructor for irregular quadrilateral aperture
695
         * @param x1 X coordinate of vertex 1
696
         * @param y1 Y coordinate of vertex 1
697
         * @param x2 X coordinate of vertex 2
698
         * @param y2 Y coordinate of vertex 2
699
         * @param x3 X coordinate of vertex 3
700
         * @param y3 Y coordinate of vertex 3
701
         * @param x4 X coordinate of vertex 4
702
         * @param y4 Y coordinate of vertex 4
703
         */
704
        IrregularQuadrilateral(double x1, double y1,
705
                               double x2, double y2,
706
                               double x3, double y3,
707
                               double x4, double y4);
708

709
        /**
710
         * @brief Json-based constructor for irregular quadrilateral aperture
711
         * @param jnode contains x1, y1, x2, y2, x3, y3, x4, y4
712
         */
713
        IrregularQuadrilateral(const nlohmann::ordered_json &jnode);
714

715
        ~IrregularQuadrilateral() {}
6✔
716

717
        /**
718
         * @brief Calculate irregular quadrilateral aperture area
719
         * @return Area of the quadrilateral aperture
720
         */
721
        virtual double aperture_area() const override;
722

723
        /**
724
         * @brief Get diameter of circumscribed circle for quadrilateral
725
         * @return Diameter of smallest circle containing quadrilateral
726
         */
727
        virtual double diameter_circumscribed_circle() const override;
728

729
        virtual void bounding_box(double &xmin,
730
                                  double &xmax,
731
                                  double &ymin,
732
                                  double &ymax) const override;
733

734
        /**
735
         * @brief Test if point is inside irregular quadrilateral
736
         * @param x X coordinate
737
         * @param y Y coordinate
738
         * @return True if point is within quadrilateral
739
         */
740
        virtual bool is_in(double x, double y) const override;
741

742
        /**
743
         * @brief Create copy of irregular quadrilateral aperture
744
         * @return Shared pointer to quadrilateral copy
745
         */
746
        virtual aperture_ptr make_copy() const override;
747

748
        /**
749
         * @brief Write aperture parameters to json
750
         * @param jnode JSON node
751
         */
752
        virtual void write_json(nlohmann::ordered_json &jnode) const override;
753

754
        /**
755
         * @brief Triangulate the quad shape
756
         * @return Tuple of 2D vertices and triangle indices
757
         */
758
        virtual std::tuple<std::vector<double>, std::vector<int>>
759
        triangulation() const override;
760
    };
761

762
    /**
763
     * @brief Test if point is inside triangle defined by three vertices
764
     * @param x1 X coordinate of vertex 1
765
     * @param y1 Y coordinate of vertex 1
766
     * @param x2 X coordinate of vertex 2
767
     * @param y2 Y coordinate of vertex 2
768
     * @param x3 X coordinate of vertex 3
769
     * @param y3 Y coordinate of vertex 3
770
     * @param xt X coordinate of test point
771
     * @param yt Y coordinate of test point
772
     * @return True if point is inside triangle
773
     */
774
    bool intri(double x1, double y1,
775
               double x2, double y2,
776
               double x3, double y3,
777
               double xt, double yt);
778

779
    /**
780
     * @brief Test if point is inside quadrilateral defined by four vertices
781
     * @param x1 X coordinate of vertex 1
782
     * @param y1 Y coordinate of vertex 1
783
     * @param x2 X coordinate of vertex 2
784
     * @param y2 Y coordinate of vertex 2
785
     * @param x3 X coordinate of vertex 3
786
     * @param y3 Y coordinate of vertex 3
787
     * @param x4 X coordinate of vertex 4
788
     * @param y4 Y coordinate of vertex 4
789
     * @param xt X coordinate of test point
790
     * @param yt Y coordinate of test point
791
     * @return True if point is inside quadrilateral
792
     */
793
    bool inquad(double x1, double y1,
794
                double x2, double y2,
795
                double x3, double y3,
796
                double x4, double y4,
797
                double xt, double yt);
798

799
} // namespace SolTrace::Data
800

801
/**
802
 * @}
803
 */
804

805
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc