Predicates
This section lists predicates that can be used to check properties of geometric objects, both of themselves and relative to other geometric objects.
One important note to make is that these predicates are not necessarily exact. For example, rather than checking if a point p is exactly in a sphere of radius r centered at c, we check if norm(p-c) ≈ r with an absolute tolerance depending on the point type, so p might be slightly outside the sphere but still be considered as being inside. This absolute tolerance can be adjusted in specific scopes as discussed in the Tolerances section.
Robust predicates are often expensive to apply and approximations typically suffice. If needed, consider ExactPredicates.jl or AdaptivePredicates.jl.
isparametrized
Meshes.isparametrized — Functionisparametrized(object)Tells whether or not the geometric object is parametrized, i.e. can be called as object(u₁, u₂, ..., uₙ) with local coordinates (u₁, u₂, ..., uₙ) ∈ [0,1]ⁿ where n is the parametric dimension.
See also paramdim.
Meshes.paramdim — Functionparamdim(geometry)Return the number of parametric dimensions of the geometry. For example, a sphere embedded in 3D has 2 parametric dimensions (polar and azimuthal angles).
See also isparametrized.
paramdim(polytope)Return the parametric dimension or rank of the polytope.
paramdim(connectivity)Return the parametric dimension of the connectivity.
paramdim(domain)Return the number of parametric dimensions of the domain as the number of parametric dimensions of its elements.
iscurve
Meshes.iscurve — Functioniscurve(g)Tells whether or not the geometry g is a curve.
issurface
Meshes.issurface — Functionissurface(g)Tells whether or not the geometry g is a surface.
issolid
Meshes.issolid — Functionissolid(g)Tells whether or not the geometry g is a solid (i.e., 3D volume).
isperiodic
Meshes.isperiodic — Functionisperiodic(topology)Tells whether or not the topology is periodic along each parametric dimension.
isperiodic(geometry)Tells whether or not the geometry is periodic along each parametric dimension.
isperiodic(grid)Tells whether or not the grid is periodic along each parametric dimension.
issimplex
Meshes.issimplex — Functionissimplex(geometry)Tells whether or not the geometry is a simplex.
issimplex(connectivity)Tells whether or not the connectivity is a simplex.
isclosed
Meshes.isclosed — Functionisclosed(chain)Tells whether or not the chain is closed.
A closed chain is also known as a ring.
isconvex
Meshes.isconvex — Functionisconvex(geometry)Tells whether or not the geometry is convex.
issimple
Meshes.issimple — Functionissimple(polygon)Tells whether or not the polygon is simple. See https://en.wikipedia.org/wiki/Simple_polygon.
issimple(chain)Tells whether or not the chain is simple.
A chain is simple when all its segments only intersect at end points.
hasholes
Meshes.hasholes — Functionhasholes(geometry)Tells whether or not the geometry contains holes.
point₁ ≤ point₂
Base.:< — Method<(x, y)Less-than comparison operator. Falls back to isless. Because of the behavior of floating-point NaN values, this operator implements a partial order.
Implementation
New types with a canonical partial order should implement this function for two arguments of the new type. Types with a canonical total order should implement isless instead.
See also isunordered.
Examples
julia> 'a' < 'b'
true
julia> "abc" < "abd"
true
julia> 5 < 3
falseBase.:> — Method>(x, y)Greater-than comparison operator. Falls back to y < x.
Implementation
Generally, new types should implement < instead of this function, and rely on the fallback definition >(x, y) = y < x.
Examples
julia> 'a' > 'b'
false
julia> 7 > 3 > 1
true
julia> "abc" > "abd"
false
julia> 5 > 3
trueBase.:≤ — Method<=(x, y)
≤(x,y)Less-than-or-equals comparison operator. Falls back to (x < y) | (x == y).
Examples
julia> 'a' <= 'b'
true
julia> 7 ≤ 7 ≤ 9
true
julia> "abc" ≤ "abc"
true
julia> 5 <= 3
falseBase.:≥ — Method>=(x, y)
≥(x,y)Greater-than-or-equals comparison operator. Falls back to y <= x.
Examples
julia> 'a' >= 'b'
false
julia> 7 ≥ 7 ≥ 3
true
julia> "abc" ≥ "abc"
true
julia> 5 >= 3
truepoint₁ ⪯ point₂
Meshes.:≺ — Method≺(A::Point, B::Point)The product order of points A and B (\prec).
A ≺ B if aᵢ < bᵢ for all coordinates aᵢ and bᵢ.
Meshes.:≻ — Method≻(A::Point, B::Point)The product order of points A and B (\succ).
A ≻ B if aᵢ > bᵢ for all coordinates aᵢ and bᵢ.
Meshes.:⪯ — Method⪯(A::Point, B::Point)The product order of points A and B (\preceq).
A ⪯ B if aᵢ ≤ bᵢ for all coordinates aᵢ and bᵢ.
Meshes.:⪰ — Method⪰(A::Point, B::Point)The product order of points A and B (\succeq).
A ⪰ B if aᵢ ≥ bᵢ for all coordinates aᵢ and bᵢ.
point ∈ geometry
Base.in — Methodpoint ∈ geometryTells whether or not the point is in the geometry.
geometry₁ ⊆ geometry₂
Base.issubset — Methodgeometry₁ ⊆ geometry₂Tells whether or not geometry₁ is contained in geometry₂.
intersects
Meshes.intersects — Functionintersects(geometry₁, geometry₂)Tells whether or not geometry₁ and geometry₂ intersect.
References
- Gilbert, E., Johnson, D., Keerthi, S. 1988. A fast Procedure for Computing the Distance Between Complex Objects in Three-Dimensional Space
Notes
The fallback algorithm works with any geometry that has a well-defined supportfun.
Meshes.supportfun — Functionsupportfun(geometry, direction)Support function of geometry for given direction.
References
- Gilbert, E., Johnson, D., Keerthi, S. 1988. A fast Procedure for Computing the Distance Between Complex Objects in Three-Dimensional Space
outer = [(0,0),(1,0),(1,1),(0,1)]
hole1 = [(0.2,0.2),(0.4,0.2),(0.4,0.4),(0.2,0.4)]
hole2 = [(0.6,0.2),(0.8,0.2),(0.8,0.4),(0.6,0.4)]
poly = PolyArea([outer, hole1, hole2])
ball1 = Ball((0.5,0.5), 0.05)
ball2 = Ball((0.3,0.3), 0.05)
ball3 = Ball((0.7,0.3), 0.05)
ball4 = Ball((0.3,0.3), 0.15)
intersects(poly, ball1)trueintersects(poly, ball2)trueintersects(poly, ball3)trueintersects(poly, ball4)trueiscollinear
Meshes.iscollinear — Functioniscollinear(A, B, C)Tells whether or not the points A, B and C are collinear.
iscoplanar
Meshes.iscoplanar — Functioniscoplanar(A, B, C, D)Tells whether or not the points A, B, C and D are coplanar.