Geometry¶
Synthetic-geometry predicate tests on concrete numeric coordinates.
GeometricTest¶
Tests whether one or more geometric objects satisfy a named property or
relation, returning True or False.
Points are collinear when they all lie on a single line.
Polygon predicates such as "Convex" accept a Polygon object.
A square is convex, regular, and a rectangle.
Lines can be tested for "Parallel" and "Perpendicular".
$ wo 'GeometricTest[{InfiniteLine[{{0, 0}, {1, 1}}], InfiniteLine[{{0, 1}, {1, 2}}]}, "Parallel"]'
True
$ wo 'GeometricTest[{InfiniteLine[{{0, 0}, {1, 1}}], InfiniteLine[{{0, 0}, {1, -1}}]}, "Perpendicular"]'
True
Triangles can be compared with "Congruent" and "Similar".
$ wo 'GeometricTest[{Triangle[{{0, 0}, {3, 0}, {0, 4}}], Triangle[{{0, 0}, {6, 0}, {0, 8}}]}, "Similar"]'
True
$ wo 'GeometricTest[{Triangle[{{0, 0}, {3, 0}, {0, 4}}], Triangle[{{0, 0}, {6, 0}, {0, 8}}]}, "Congruent"]'
False
Multiple properties are tested simultaneously; the result is True only when
all of them hold.
ConvexHullMesh¶
The convex hull of a 2D point set is returned as a BoundaryMeshRegion.
Interior and collinear-on-edge points are dropped; the remaining corners stay
in input order and the boundary Line walks them counter-clockwise.
$ wo 'ConvexHullMesh[{{0, 0}, {2, 0}, {2, 2}, {0, 2}, {1, 1}}]'
BoundaryMeshRegion[{{0, 0}, {2, 0}, {2, 2}, {0, 2}}, {Line[{{1, 2}, {2, 3}, {3, 4}, {4, 1}}]}, Method -> {SeparateBoundaries -> False}, WorkingPrecision -> Infinity]
A machine-real coordinate switches every vertex to a real and drops the
WorkingPrecision option.
$ wo 'ConvexHullMesh[{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {0.5, 0.5}}]'
BoundaryMeshRegion[{{0., 0.}, {1., 0.}, {0., 1.}, {1., 1.}}, {Line[{{1, 2}, {2, 4}, {4, 3}, {3, 1}}]}, Method -> {SeparateBoundaries -> False}]
RegionProduct¶
The Cartesian product of regions, which is answered with a named primitive rather than a product object. Coordinates of the earlier arguments come first, so two segments span a rectangle:
A disk swept along a segment is a cylinder, a triangle swept along one a prism:
$ wo 'RegionProduct[Triangle[], Interval[{0, 2}]]'
Prism[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 2}, {1, 0, 2}, {0, 1, 2}}]
The product is measured like any other region:
A pair with no primitive to become is left standing:
CircularArcThrough¶
The arc of the circle through the given points, written as a Circle running
from the smallest of their angles about the centre to the largest.
Two points alone are the ends of a diameter:
The result is a region like any other arc:
Points no circle passes through — collinear ones, or too few — are refused:
$ wo 'CircularArcThrough[{{0, 0}, {1, 0}, {2, 0}}]'
CircularArcThrough::indep: CircularArcThrough does not exist for {{0, 0}, {1, 0}, {2, 0}}.
CircularArcThrough[{{0, 0}, {1, 0}, {2, 0}}]
ConvexPolyhedronQ¶
Whether a region is a convex polyhedron: bounded, flat-faced and three-dimensional.
A curved solid is not one, and neither is a flat region:
Corners of your own are measured — skewing one so a side stops being flat takes the convexity with it:
$ wo 'ConvexPolyhedronQ[Prism[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1, 0, 1}, {0, 1, 1}}]]'
True
$ wo 'ConvexPolyhedronQ[Prism[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {5, 0, 1}, {0, 1, 1}}]]'
False
PolyhedronData¶
Named polyhedra and their properties: the Platonic solids, plus the Archimedean solids with icosahedral symmetry and their Catalan duals.
The football: twelve pentagons and twenty hexagons.
Metric properties stay exact:
An Archimedean solid has a circumsphere but no insphere, its dual the other way round:
"Faces" gives the corners and the faces that index into them, in one
GraphicsComplex: