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.

Exact arithmetic is expensive to apply and approximations are typically sufficient; exact predicates are available in ExactPredicates.jl if you need them.

isparametrized

Meshes.isparametrizedFunction
isparametrized(geometry)

Tells whether or not the geometry is parametrized, i.e. can be called as geometry(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 ∈ 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 = Point2[(0,0),(1,0),(1,1),(0,1)]
hole1 = Point2[(0.2,0.2),(0.4,0.2),(0.4,0.4),(0.2,0.4)]
hole2 = Point2[(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)
false
intersects(poly, ball3)
false
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