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.isparametrizedFunction
isparametrized(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.

source
Meshes.paramdimFunction
paramdim(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.

source
paramdim(polytope)

Return the parametric dimension or rank of the polytope.

source
paramdim(connectivity)

Return the parametric dimension of the connectivity.

source
paramdim(domain)

Return the number of parametric dimensions of the domain as the number of parametric dimensions of its elements.

source

isperiodic

Meshes.isperiodicFunction
isperiodic(topology)

Tells whether or not the topology is periodic along each parametric dimension.

source
isperiodic(geometry)

Tells whether or not the geometry is periodic along each parametric dimension.

source
isperiodic(grid)

Tells whether or not the grid is periodic along each parametric dimension.

source

issimplex

Meshes.issimplexFunction
issimplex(geometry)

Tells whether or not the geometry is a simplex.

source
issimplex(connectivity)

Tells whether or not the connectivity is a simplex.

source

isclosed

Meshes.isclosedFunction
isclosed(chain)

Tells whether or not the chain is closed.

A closed chain is also known as a ring.

source

isconvex

issimple

hasholes

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
false
source
Base.:>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
true
source
Base.:≤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
false
source
Base.:≥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
true
source

point₁ ⪯ point₂

point ∈ geometry

Base.inMethod
point ∈ geometry

Tells whether or not the point is in the geometry.

source

geometry₁ ⊆ geometry₂

Base.issubsetMethod
geometry₁ ⊆ geometry₂

Tells whether or not geometry₁ is contained in geometry₂.

source

intersects

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)
true
intersects(poly, ball2)
true
intersects(poly, ball3)
true
intersects(poly, ball4)
true

iscollinear

iscoplanar

Meshes.iscoplanarFunction
iscoplanar(A, B, C, D)

Tells whether or not the points A, B, C and D are coplanar.

source