11#ifndef JAU_MATH_GEOM_GEOM3F2D_HPP_ 
   12#define JAU_MATH_GEOM_GEOM3F2D_HPP_ 
   46        size_t n = vertices.size();
 
   48        for (
size_t p = n - 1, q = 0; q < n; p = q++) {
 
   49            const Vec3f& pCoord = vertices[p];
 
   50            const Vec3f& qCoord = vertices[q];
 
   51            area += (double)pCoord.
x * (
double)qCoord.
y - (double)qCoord.
x * (
double)pCoord.
y;
 
 
   73    constexpr double sqlend(
double x, 
double y) 
noexcept {
 
 
   76    constexpr double triArea(
double ax, 
double ay, 
double bx, 
double by, 
double cx, 
double cy) 
noexcept {
 
   77        return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
 
 
   79    constexpr double triArea(
float ax, 
float ay, 
float bx, 
float by, 
float cx, 
float cy) 
noexcept {
 
   80        return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
 
 
   95        return triArea(a.x, a.y, b.x, b.y, c.x, c.y);
 
 
  118        return inCircle2DVal(a, b, c, d) > std::numeric_limits<double>::epsilon();
 
 
  134        return triArea2D(a,b,c) > std::numeric_limits<double>::epsilon();
 
 
  171        const float rx = p2.x - p.x; 
 
  172        const float ry = p2.y - p.y;
 
  173        const float sx = q2.x - q.x; 
 
  174        const float sy = q2.y - q.y;
 
  175        const float rxs = rx * sy - ry * sx; 
 
  177        constexpr float eps = std::numeric_limits<float>::epsilon();
 
  184            const float q_px = q.x - p.x; 
 
  185            const float q_py = q.y - p.y;
 
  186            const float qpxr = q_px * ry - q_py * rx; 
 
  192            const float t = ( q_px * sy - q_py * sx ) / rxs; 
 
  195            const float u = qpxr / rxs;
 
  198            if ( (eps <= t && t - 1 <= eps) && (eps <= u && u - 1 <= eps) )
 
 
Implementation of a dynamic linear array storage, aka vector, including relative positional access.
 
constexpr bool is_zero(const T &a, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if the given value is less than epsilon, w/ epsilon > 0.
 
constexpr double sqlend(double x, double y) noexcept
 
constexpr double triArea2D(const Vec3f &a, const Vec3f &b, const Vec3f &c) noexcept
Computes oriented double area of a triangle, i.e.
 
constexpr bool is2DCCW(const Vec3f &a, const Vec3f &b, const Vec3f &c) noexcept
Check if points are in ccw order.
 
constexpr bool testSeg2SegIntersection2D(Vec2f *result, const Vec2f &p, const Vec2f &p2, const Vec2f &q, const Vec2f &q2, const bool do_collinear=false) noexcept
See p + t r = q + u s and its terse C# implementation
 
constexpr double triArea(double ax, double ay, double bx, double by, double cx, double cy) noexcept
 
jau::darray< Vec3f, jau::nsize_t > Vec3fList
 
constexpr Winding get2DWinding(const Vec3f &a, const Vec3f &b, const Vec3f &c) noexcept
Compute the winding of the 3 given points.
 
constexpr double area2D(const Vec3fList &vertices) noexcept
Computes the area of a list of vertices via shoelace formula.
 
constexpr Winding getArea2DWinding(const Vec3fList &vertices) noexcept
Compute the winding using the area2D() function over all vertices for complex shapes.
 
constexpr bool testTri2SegIntersection2D(const Vec3f &a, const Vec3f &b, const Vec3f &c, const Vec3f &d, const Vec3f &e)
Check if a segment intersects with a triangle using FloatUtil#EPSILON w/o considering collinear-case.
 
constexpr bool isInCircle2D(const Vec3f &a, const Vec3f &b, const Vec3f &c, const Vec3f &d) noexcept
Check if vertices in triangle circumcircle given d vertex, from paper by Guibas and Stolfi (1985).
 
constexpr double inCircle2DVal(const Vec3f &a, const Vec3f &b, const Vec3f &c, const Vec3f &d) noexcept