Small inputs / visible answers

Algorithms,
in two dimensions.

See what goes in, what comes out, and why. Start with hull vertices, then intersect two simple sets.

These are educational illustrations of reviewed saved outputs, not an execution trace or new performance measurements. All configurations are complete and every result links back to native records.

Download inputs and displayed outputs (JSON)

Example 01 / 2D geometry

Find the convex hull

Stretch a rubber band around these points. The band touches only the extreme vertices; the center point does not change the hull. Coincident input rows share one location.

Stretch a rubber band around these points. The band touches only the extreme vertices; the center point does not change the hull. Coincident input rows share one location.
Green: hull boundary; amber: omitted points. Slash-separated original IDs coincide. Equal x/y scale.

Returned original vertex IDs: [0, 1, 2, 3].

Coordinates (rounded to six significant digits; raw JSON retains binary64 values)
Original point IDxyRole
000hull vertex
110hull vertex
211hull vertex
301hull vertex
40.50.5interior / omitted
500duplicate of point 0
610duplicate of point 1
Complete minimal input
{
  "points": [
    [
      0,
      0
    ],
    [
      1,
      0
    ],
    [
      1,
      1
    ],
    [
      0,
      1
    ],
    [
      0.5,
      0.5
    ],
    [
      0,
      0
    ],
    [
      1,
      0
    ]
  ]
}
Minimal public C++ call
#include <csl/geometry/quickhull_2d.hpp>
#include <iostream>
#include <vector>

int main() {
    const std::vector<csl::Vector> points = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0.5, 0.5}, {0, 0}, {1, 0}};
    auto result = csl::geometry::quickhull_2d(points);
    const auto* hull = std::get_if<csl::geometry::QuickHull2D>(&result);
    if (!hull) return 1;
    for (auto id : hull->vertex_indices) std::cout << id << " ";
}
// Link the installed target CSL::quickhull_2d (C++20).
Reproduce the native functional example

From a checkout of harness commit 74651cb028b9c2359d666ae5f141c66e0b03708b, using CMake 3.31+ and a C++20 compiler:

cmake -S . -B build/visual-geo06 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCSL_BUILD_GEO06_REPORT=ON -DCSL_ENABLE_HIGHS=OFF -DCSL_ENABLE_QHULL=OFF
cmake --build build/visual-geo06 --config Release --target csl_geo06_quickhull_report --parallel 2
./build/visual-geo06/csl_geo06_quickhull_report --smoke

For Visual Studio, use its developer shell, configure with its generator, and run Release/csl_geo06_quickhull_report.exe --smoke in the build directory. This is a functional smoke, not a new benchmark; discard smoke timing values.

Complete native fixture/driver ↗

The first input ID wins for coincident points. Polygon vertices start at the lexicographically smallest point and continue counterclockwise, without repeating the closing vertex. QuickHull uses exact orientation for the supplied binary64 coordinates; these small cases do not establish general performance.

Algorithm source ce63bff5a0face88c3c5e977f7d96337e8cbe948

Reviewed numerical report ↗ · Full saved native records ↗

Example 02 / 2D geometry

When the hull is a line

All points lie on y = x. The convex hull is the segment from (0, 0) to (3, 3), so only its two endpoints are retained. Intermediate collinear points are omitted.

All points lie on y = x. The convex hull is the segment from (0, 0) to (3, 3), so only its two endpoints are retained. Intermediate collinear points are omitted.
Green: hull boundary; amber: omitted points. Slash-separated original IDs coincide. Equal x/y scale.

Returned original vertex IDs: [1, 3].

Coordinates (rounded to six significant digits; raw JSON retains binary64 values)
Original point IDxyRole
022interior / omitted
100hull vertex
211interior / omitted
333hull vertex
422duplicate of point 0
Complete minimal input
{
  "points": [
    [
      2,
      2
    ],
    [
      0,
      0
    ],
    [
      1,
      1
    ],
    [
      3,
      3
    ],
    [
      2,
      2
    ]
  ]
}
Minimal public C++ call
#include <csl/geometry/quickhull_2d.hpp>
#include <iostream>
#include <vector>

int main() {
    const std::vector<csl::Vector> points = {{2, 2}, {0, 0}, {1, 1}, {3, 3}, {2, 2}};
    auto result = csl::geometry::quickhull_2d(points);
    const auto* hull = std::get_if<csl::geometry::QuickHull2D>(&result);
    if (!hull) return 1;
    for (auto id : hull->vertex_indices) std::cout << id << " ";
}
// Link the installed target CSL::quickhull_2d (C++20).
Reproduce the native functional example

From a checkout of harness commit 74651cb028b9c2359d666ae5f141c66e0b03708b, using CMake 3.31+ and a C++20 compiler:

cmake -S . -B build/visual-geo06 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCSL_BUILD_GEO06_REPORT=ON -DCSL_ENABLE_HIGHS=OFF -DCSL_ENABLE_QHULL=OFF
cmake --build build/visual-geo06 --config Release --target csl_geo06_quickhull_report --parallel 2
./build/visual-geo06/csl_geo06_quickhull_report --smoke

For Visual Studio, use its developer shell, configure with its generator, and run Release/csl_geo06_quickhull_report.exe --smoke in the build directory. This is a functional smoke, not a new benchmark; discard smoke timing values.

Complete native fixture/driver ↗

The first input ID wins for coincident points. Polygon vertices start at the lexicographically smallest point and continue counterclockwise, without repeating the closing vertex. QuickHull uses exact orientation for the supplied binary64 coordinates; these small cases do not establish general performance.

Algorithm source ce63bff5a0face88c3c5e977f7d96337e8cbe948

Reviewed numerical report ↗ · Full saved native records ↗

Example 03 / 2D geometry

Intersect two sets

Keep points that satisfy both shapes: the square −1 ≤ x,y ≤ 1 and the diamond |x| + |y| ≤ 1.5. Each shape cuts off four corners of the other. The shared region is an octagon.

Keep points that satisfy both shapes: the square −1 ≤ x,y ≤ 1 and the diamond |x| + |y| ≤ 1.5. Each shape cuts off four corners of the other. The shared region is an octagon.
Green: returned intersection. Blue: input square; amber: input diamond. Labels are saved output row IDs. Equal x/y scale.

Expected vertices: (±1, ±0.5) and (±0.5, ±1), all sign combinations.

Coordinates (rounded to six significant digits; raw JSON retains binary64 values)
Saved output row IDxyRole
0-1-0.5intersection vertex
1-0.5-1intersection vertex
21-0.5intersection vertex
30.5-1intersection vertex
4-10.5intersection vertex
5-0.51intersection vertex
610.5intersection vertex
70.51intersection vertex
Complete minimal input
{
  "left_A": [
    [
      1,
      0
    ],
    [
      -1,
      0
    ],
    [
      0,
      1
    ],
    [
      0,
      -1
    ]
  ],
  "left_b": [
    1,
    1,
    1,
    1
  ],
  "right_A": [
    [
      1,
      1
    ],
    [
      1,
      -1
    ],
    [
      -1,
      1
    ],
    [
      -1,
      -1
    ]
  ],
  "right_b": [
    1.5,
    1.5,
    1.5,
    1.5
  ]
}

The complete inputs below use A·[x,y] ≤ b for each shape. The driver links CSL::polyhedral, CSL::qhull_conversion and CSL::highs_lp.

Reproduce the native functional example

From a checkout of harness commit b83b8dc415dbe5811371b8446931ae4c6f3d2e28, using CMake 3.31+ and a C++20 compiler:

cmake -S . -B build/visual-geo04 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCSL_BUILD_GEO04_REPORT=ON
cmake --build build/visual-geo04 --config Release --target csl_geo04_intersection_report --parallel 2
./build/visual-geo04/csl_geo04_intersection_report --smoke

For Visual Studio, use its developer shell, configure with its generator, and run Release/csl_geo04_intersection_report.exe --smoke in the build directory. This is a functional smoke, not a new benchmark; discard smoke timing values.

Complete native fixture/driver ↗

The plot uses the saved native vertex coordinates, not idealized oracle replacements. Qhull/HiGHS outputs match this fixture within absolute tolerance 1e−7; they are numerical geometry, not a validated exact enclosure. Vertex row order is not a promised cyclic boundary order.

Algorithm source 9579f9e936d85d66c59003b2a04157c153df6b63

Reviewed numerical report ↗ · Full saved native records ↗

Next: control in the plane

Position/velocity trajectories and reachable sets are a planned extension. The true two-state scenario is tracked in #421; current scalar integrator examples do not establish a two-state demonstration.