Predicates
Certificates
DelaunayTriangulation.Certificate — Module
CertificateThis is an Enum that defines certificates returned from predicates. The instances, and associated certifiers, are:
Inside:is_insideDegenerate:is_degenerateOutside:is_outsideOn:is_onLeft:is_leftRight:is_rightPositivelyOriented:is_positively_orientedNegativelyOriented:is_negatively_orientedCollinear:is_collinearNone:is_noneorhas_no_intersectionsSingle:is_singleorhas_one_intersectionMultiple:is_multipleorhas_multiple_intersectionsTouching:is_touchingLegal:is_legalIllegal:is_illegalCloser:is_closerFurther:is_furtherEquidistant:is_equidistantObtuse:is_obtuseAcute:is_acuteSuccessfulInsertion:is_successful_insertionFailedInsertion:is_failed_insertionPrecisionFailure:is_precision_failureEncroachmentFailure:is_encroachment_failureAbove:is_aboveBelow:is_belowVisible:is_visibleInvisible:is_invisible
DelaunayTriangulation.is_inside — Function
is_inside(cert::Certificate) -> BoolReturns true if cert is Inside, and false otherwise.
DelaunayTriangulation.is_degenerate — Function
is_degenerate(cert::Certificate) -> BoolReturns true if cert is Degenerate, and false otherwise.
DelaunayTriangulation.is_outside — Function
is_outside(cert::Certificate) -> BoolReturns true if cert is Outside, and false otherwise.
DelaunayTriangulation.is_on — Function
is_on(cert::Certificate) -> BoolReturns true if cert is On, and false otherwise.
DelaunayTriangulation.is_left — Function
is_left(cert::Certificate) -> BoolReturns true if cert is Left, and false otherwise.
DelaunayTriangulation.is_right — Function
is_right(cert::Certificate) -> BoolReturns true if cert is Right, and false otherwise.
DelaunayTriangulation.is_positively_oriented — Function
is_positively_oriented(tri::Triangulation, curve_index) -> BoolTests if the curve_indexth curve in tri is positively oriented, returning true if so and false otherwise.
is_positively_oriented(cert::Certificate) -> BoolReturns true if cert is PositivelyOriented, and false otherwise.
DelaunayTriangulation.is_negatively_oriented — Function
is_negatively_oriented(cert::Certificate) -> BoolReturns true if cert is NegativelyOriented, and false otherwise.
DelaunayTriangulation.is_collinear — Function
is_collinear(cert::Certificate) -> BoolReturns true if cert is Collinear, and false otherwise.
DelaunayTriangulation.is_none — Function
is_none(cert::Certificate) -> BoolReturns true if cert is None, and false otherwise.
DelaunayTriangulation.has_no_intersections — Function
has_no_intersections(cert::Certificate) -> BoolReturns true if cert is None, and false otherwise. Synonymous with is_none.
DelaunayTriangulation.is_single — Function
is_single(cert::Certificate) -> BoolReturns true if cert is Single, and false otherwise.
DelaunayTriangulation.has_one_intersection — Function
has_one_intersection(cert::Certificate) -> BoolReturns true if cert is Single, and false otherwise. Synonymous with is_single.
DelaunayTriangulation.is_multiple — Function
is_multiple(cert::Certificate) -> BoolReturns true if cert is Multiple, and false otherwise.
DelaunayTriangulation.has_multiple_intersections — Function
has_multiple_intersections(cert::Certificate) -> BoolReturns true if cert is Multiple, and false otherwise. Synonymous with is_multiple.
DelaunayTriangulation.is_touching — Function
is_touching(r1::BoundingBox, r2::BoundingBox) -> BoolTests whether r1 and r2 are touching, i.e. if they share a common boundary. This only considers interior touching.
is_touching(cert::Certificate) -> BoolReturns true if cert is Touching, and false otherwise.
DelaunayTriangulation.is_illegal — Function
is_illegal(cert::Certificate) -> BoolReturns true if cert is Illegal, and false otherwise.
DelaunayTriangulation.is_closer — Function
is_closer(cert::Certificate) -> BoolReturns true if cert is Closer, and false otherwise.
DelaunayTriangulation.is_further — Function
is_further(cert::Certificate) -> BoolReturns true if cert is Further, and false otherwise.
DelaunayTriangulation.is_equidistant — Function
is_equidistant(cert::Certificate) -> BoolReturns true if cert is Equidistant, and false otherwise.
DelaunayTriangulation.is_obtuse — Function
is_obtuse(cert::Certificate) -> BoolReturns true if cert is Obtuse, and false otherwise.
DelaunayTriangulation.is_acute — Function
is_acute(cert::Certificate) -> BoolReturns true if cert is Acute, and false otherwise.
DelaunayTriangulation.is_above — Function
is_above(cert::Certificate) -> BoolReturns true if cert is Above, and false otherwise.
DelaunayTriangulation.is_below — Function
is_below(cert::Certificate) -> BoolReturns true if cert is Below, and false otherwise.
Predicates
DelaunayTriangulation.AbstractPredicateKernel — Type
abstract type AbstractPredicateKernelAbstract type for defining a method for computing predicates. The subtypes are:
FastKernel: Uses the determinant definitions of the predicates, with no adaptivity or exact arithmetic.ExactKernel: Uses ExactPredicates.jl.AdaptiveKernel: Uses AdaptivePredicates.jl.
Please see the documentation for more information on the differences between these predicate types.
DelaunayTriangulation.FastKernel — Type
FastKernel()Pass this to predicates to declare that determinant definitions of predicates should be used, avoiding adaptivity and exact arithmetic.
See also ExactKernel and AdaptiveKernel.
DelaunayTriangulation.ExactKernel — Type
ExactKernel()Pass this to predicates to use ExactPredicates.jl for computing predicates.
See also FastKernel and AdaptiveKernel.
DelaunayTriangulation.AdaptiveKernel — Type
AdaptiveKernel()Pass this to predicates to use AdaptivePredicates.jl for computing predicates.
See also FastKernel and ExactKernel.
DelaunayTriangulation.orient_predicate — Function
orient_predicate([kernel::AbstractPredicateKernel,] p, q, r) -> IntegerReturns
1:(p, q, r)is positively oriented.0:(p, q, r)is collinear / degenerate.-1:(p, q, r)is negatively oriented.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
orient_predicate([kernel::AbstractPredicateKernel,] p, q, r; cache = nothing) -> IntegerReturns
1:(p, q, r, s)is positively oriented.0:(p, q, r, s)is collinear / degenerate.-1:(p, q, r, s)is negatively oriented.
Here, a positively oriented tetrahedron (p, q, r, s) takes the form
z.
.
,/
s
,/|'\
,/ | '\
,/ '. '\
,/ | '\
,/ | '\
p-----------'.--------q --> x
'\. | ,/
'\. | ,/
'\. '. ,/
'\. |/
'r
'\.The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The optional cache keyword argument can be used for preallocating memory for intermediate results, passing the argument from AdaptivePredicates.orient3adapt_cache(T), where T is the number type of the input points. If nothing is passed, no cache is used. This is only needed if an AdaptiveKernel() is used.
DelaunayTriangulation.incircle_predicate — Function
incircle_predicate([kernel::AbstractPredicateKernel,] a, b, c, p; cache = nothing) -> IntegerAssuming that (a, b, c) is a positively oriented triangle, returns
1: Ifpis inside the circle defined by(a, b, c).0: Ifpis on the circle defined by(a, b, c).-1: Ifpis outside the circle defined by(a, b, c).
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The optional cache keyword argument can be used for preallocating memory for intermediate results, passing the argument from AdaptivePredicates.incircleadapt_cache(T), where T is the number type of the input points. If nothing is passed, no cache is used. This is only needed if an AdaptiveKernel() is used.
DelaunayTriangulation.parallelorder_predicate — Function
parallelorder_predicate([kernel::AbstractPredicateKernel,] a, b, p, q) -> IntegerReturns
1:qis closer to the line(a, b)thanp.0:pandqare equidistant from the line(a, b).-1:pis closer to the line(a, b)thanq.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.angle_is_acute_predicate — Function
angle_is_acute([kernel::AbstractPredicateKernel,] p, q, r)Tests if the angle opposite (p, q) in the triangle (p, q, r), meaning ∠prq, is acute, returning:
1:∠prqis acute.0:∠prqis a right angle.-1:∠prqis obtuse.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.sameside_predicate — Function
sameside_predicate(a, b, p) -> IntegerAssuming all of a, b, p are collinear, returns
1:aandbare on the same side ofpon the line.0:a == porb == p.-1:aandbare on different sides ofpon the line.
DelaunayTriangulation.meet_predicate — Function
meet_predicate([kernel::AbstractPredicateKernel], p, q, a, b) -> IntegerReturns
1: The open line segments(p, q)and(a, b)meet in a single point.0: The closed line segments[p, q]and[a, b]meet in one or several points.-1: Otherwise.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.triangle_orientation — Function
triangle_orientation([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, k) -> Certificate
triangle_orientation([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, T) -> Certificate
triangle_orientation([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, r) -> CertificateComputes the orientation of the triangle T = (i, j, k) with correspondig coordinates (p, q, r). The returned value is a Certificate, which is one of:
PositivelyOriented: The triangle is positively oriented.Degenerate: The triangle is degenerate, meaning the coordinates are collinear.NegativelyOriented: The triangle is negatively oriented.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_position_relative_to_circle — Function
point_position_relative_to_circle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] a, b, c, p; cache = nothing) -> CertificateGiven a circle through the coordinates (a, b, c), assumed to be positively oriented, computes the position of p relative to the circle. Returns a Certificate, which is one of:
Inside:pis inside the circle.On:pis on the circle.Outside:pis outside the triangle.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The cache keyword argument is passed to [incircle_predicate] and should be one of
nothing: No cache is used.AdaptivePredicates.incircleadapt_cache(T), whereTis the number type used (Float64orFloat32).
The cache is only needed if an AdaptiveKernel() is used.
DelaunayTriangulation.point_position_relative_to_line — Function
point_position_relative_to_line([kernel::AbstractPredicateKernel=AdaptiveKernel(),] a, b, p) -> Certificate
point_position_relative_to_line([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, u) -> CertificateTests the position of p (or the vertex u of tri) relative to the edge (a, b) (or the edge with vertices (i, j) of tri), returning a Certificate which is one of:
Left:pis to the left of the line.Collinear:pis on the line.Right:pis to the right of the line.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_closest_to_line — Function
point_closest_to_line([kernel::AbstractPredicateKernel=AdaptiveKernel(),] a, b, p, q) -> Certificate
point_closest_to_line([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, u, v) -> CertificateGiven a line ℓ through (a, b) (or through the vertices (i, j)), tests if p (or the vertex u) is closer to ℓ than q (or the vertex v), assuming that p and q are to the left of ℓ, returning a Certificate which is one of:
Closer:pis closer toℓ.Further:qis closer toℓ.Equidistant:pandqare the same distance fromℓ.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_position_on_line_segment — Function
point_position_on_line_segment(a, b, p) -> Certificate
point_position_on_line_segment(tri::Triangulation, i, j, u) -> CertificateGiven a point p (or vertex u) and the line segment (a, b) (or edge (i, j)), assuming p to be collinear with a and b, computes the position of p relative to the line segment. The returned value is a Certificate which is one of:
On:pis on the line segment, meaning betweenaandb.Degenerate: Eitherp == aorp == b, i.e.pis one of the endpoints.Left:pis off and to the left of the line segment.Right:pis off and to the right of the line segment.
DelaunayTriangulation.line_segment_intersection_type — Function
line_segment_intersection_type([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, a, b) -> Certificate
line_segment_intersection_type([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, u, v, i, j) -> CertificateGiven the coordinates (p, q) (or vertices (u, v)) and (a, b) (or vertices (i, j)) defining two line segments, tests the number of intersections between the two segments. The returned value is a Certificate, which is one of:
None: The line segments do not meet at any points.Multiple: The closed line segments[p, q]and[a, b]meet in one or several points.Single: The open line segments(p, q)and(a, b)meet in a single point.Touching: One of the endpoints is on[a, b], but there are no other intersections.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_position_relative_to_triangle — Function
point_position_relative_to_triangle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] a, b, c, p) -> Certificate
point_position_relative_to_triangle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, k, u) -> Certificate
point_position_relative_to_triangle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, T, u) -> CertificateGiven a positively oriented triangle with coordinates (a, b, c) (or triangle T = (i, j, k) of tri), computes the position of p (or vertex u) relative to the triangle. The returned value is a Certificate, which is one of:
Outside:pis outside of the triangle.On:pis on one of the edges.Inside:pis inside the triangle.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_position_relative_to_oriented_outer_halfplane — Function
point_position_relative_to_oriented_outer_halfplane([kernel::AbstractPredicateKernel=AdaptiveKernel(),] a, b, p) -> CertificateGiven an edge with coordinates (a, b) and a point p, tests the position of p relative to the oriented outer halfplane defined by (a, b). The returned value is a Certificate, which is one of:
Outside:pis outside of the oriented outer halfplane, meaning to the right of the line(a, b)or collinear withaandbbut not on the line segment(a, b).On:pis on the line segment[a, b].Inside:pis inside of the oriented outer halfplane, meaning to the left of the line(a, b).
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
Extended help
The oriented outer halfplane is the union of the open halfplane defined by the region to the left of the oriented line (a, b), and the open line segment (a, b).
DelaunayTriangulation.is_legal — Function
is_legal([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j; cache = nothing) -> Certificate
is_legal([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, r, s[, cache = nothing]) -> CertificateTests if the edge (p, q) (or the edge (i, j) of tri) is legal, where the edge (p, q) is incident to two triangles (p, q, r) and (q, p, s). In partiuclar, tests that s is not inside the triangle through (p, q, r). The returned value is a Certificate, which is one of:
Legal: The edge(p, q)is legal.Illegal: The edge(p, q)is illegal.
If the edge (i, j) is a segment of tri or is a ghost edge, then the edge is always legal.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The cache keyword argument is passed to [point_position_relative_to_circumcircle] and should be one of
nothing: No cache is used.AdaptivePredicates.incircleadapt_cache(T), whereTis the number type used (Float64orFloat32).
The cache is only needed if an AdaptiveKernel() is used.
DelaunayTriangulation.triangle_line_segment_intersection — Function
triangle_line_segment_intersection([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, r, a, b) -> Certificate
triangle_line_segment_intersection([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, k, u, v) -> CertificateClassifies the intersection of the line segment (a, b) (or the edge (u, v) of tri) with the triangle (p, q, r) (or the triangle (i, j, k) of tri). The returned value is a Certificate, which is one of:
Inside:(a, b)is entirely inside(p, q, r).Single:(a, b)has one endpoint inside(p, q, r), and the other is outside.Outside:(a, b)is entirely outside(p, q, r).Touching:(a, b)is on(p, q, r)'s boundary, but not in its interior.Multiple:(a, b)passes entirely through(p, q, r). This includes the case where a point is on the boundary of(p, q, r).
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.find_edge — Function
find_edge([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, T, ℓ) -> EdgeGiven a triangle T = (i, j, k) of tri and a vertex ℓ of tri, returns the edge of T that contains ℓ. If no such edge exists, the edge (k, i) is returned. You can control the method for computing predicates using the kernel argument.
DelaunayTriangulation.point_position_relative_to_circumcircle — Function
point_position_relative_to_circumcircle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, k, ℓ; cache = nothing) -> Certificate
point_position_relative_to_circumcircle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, T, ℓ; cache = nothing) -> CertificateTests the position of the vertex ℓ of tri relative to the circumcircle of the triangle T = (i, j, k). The returned value is a Certificate, which is one of:
Outside:ℓis outside of the circumcircle ofT.On:ℓis on the circumcircle ofT.Inside:ℓis inside the circumcircle ofT.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The cache keyword argument is useful when an AdaptiveKernel() is used. Depending on whether the triangulation is weighted or not, the cache should be of the following:
nothing: No cache is used.AdaptivePredicates.incircleadapt_cache(T), whereTis the number type used (Float64orFloat32). This is used for unweighted triangulations.AdaptivePredicates.orient3adapt_cache(T), whereTis the number type used (Float64orFloat32). This is used for weighted triangulations.
In case the wrong cache type is used, it is replaced with nothing.
The circumcircle of a ghost triangle is defined as the oriented outer halfplane of the solid edge of the triangle. See point_position_relative_to_oriented_outer_halfplane.
If tri is a weighted triangulation, then an orientation test is instead applied, testing the orientation of the lifted companions of each point to determine if ℓ is above or below the witness plane relative to (i, j, k). For ghost triangles, the same rule applies, although if the vertex is on the solid edge of the ghost triangle then, in addition to checking point_position_relative_to_oriented_outer_halfplane, we must check if the new vertex is not submerged by the adjoining solid triangle.
DelaunayTriangulation.point_position_relative_to_witness_plane — Function
point_position_relative_to_witness_plane([kernel::AbstractPredicateKernel=AdaptiveKernel(),] tri::Triangulation, i, j, k, ℓ; cache = nothing) -> CertificateGiven a positively oriented triangle T = (i, j, k) of tri and a vertex ℓ of tri, returns the position of ℓ relative to the witness plane of T. The returned value is a Certificate, which is one of:
Above:ℓis above the witness plane ofT.On:ℓis on the witness plane ofT.Below:ℓis below the witness plane ofT.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
The cache keyword argument is useful when an AdaptiveKernel() is used, and should be one of:
nothing: No cache is used.AdaptivePredicates.orient3adapt_cache(T), whereTis the number type used (Float64orFloat32).
Extended help
The witness plane of a triangle is defined as the plane through the triangle (i⁺, j⁺, k⁺) where, for example, pᵢ⁺ = (x, y, x^2 + y^2 - wᵢ) is the lifted companion of i and (x, y) are the coordinates of the ith vertex. Moreover, by the orientation of ℓ relative to this witness plane we are referring to ℓ⁺'s position, not the plane point ℓ.
DelaunayTriangulation.opposite_angle — Function
opposite_angle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, r) -> CertificateTests the angle opposite to the edge (p, q) in the triangle (p, q, r), meaning ∠prq. The returned value is a Certificate, which is one of:
Obtuse: The angle opposite to(p, q)is obtuse.Right: The angle opposite to(p, q)is a right angle.Acute: The angle opposite to(p, q)is acute.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
DelaunayTriangulation.point_position_relative_to_diametral_circle — Function
point_position_relative_to_diametral_circle([kernel::AbstractPredicateKernel=AdaptiveKernel(),] p, q, r) -> CertificateGiven an edge (p, q) and a point r, returns the position of r relative to the diametral circle of (p, q). The returned value is a Certificate, which is one of:
Inside:ris inside the diametral circle.On:ris on the diametral circle.Outside:ris outside the diametral circle.
The kernel argument determines how this result is computed, and should be one of ExactKernel, FastKernel, and AdaptiveKernel (the default). See the documentation for more information about these choices.
Extended help
The check is done by noting that a point is in the diametral circle if, and only if, the angle at r is obtuse.
DelaunayTriangulation.point_position_relative_to_diametral_lens — Function
point_position_relative_to_diametral_lens(p, q, r, lens_angle=30.0) -> CertificateGiven an edge (p, q) and a point r, returns the position of r relative to the diametral lens of (p, q) with lens angle lens_angle (in degrees). The returned value is a Certificate, which is one of:
Inside:ris inside the diametral lens.On:ris on the diametral lens.Outside:ris outside the diametral lens.
Extended help
The diametral lens is slightly similar to a diametral circle. Let us first define the standard definition of a diametral lens, where lens_angle = 30°, and then we define its generalisation. The standard definition was introduced by Shewchuk in 2002 in this paper, and the generalisation was originally described in Section 3.4 of Shewchuk's 1997 PhD thesis here (as was the standard definition, of course).
Standard definition: Let the segment be s ≔ (p, q) and let ℓ be the perpendicular bisector of s. Define two circles C⁺ and C⁻ whose centers lie left and right of s, respectively, both the same distance away from the midpoint m = (p + q)/2. By placing each disk a distance |s|/(2√3) away from m and extending the disks so that they both touch p and q, meaning they each have radius |s|/√3, we obtain disks that touch p and q as well as the center of the other disk. The intersection of the two disks defines the diametral lens. The lens angle associated with this lens is 30°, as we could draw lines between p and q and the poles of the disks to form isosceles triangles on each side, giving angles of 30° at p and q.
Generalised definition: The generalisation of the above definition aims to generalise the lens angle to some angle θ. In particular, let us draw a line from p towards some point u which is left of s and on the perpendicular bisector, where the line is at an angle θ. This defines a triplet of points (p, q, u) from which we can define a circle, and similarly for a point v right of s. The intersection of these two circles is the diametral lens with angle θ. We can also figure out how far u is along the perpendicular bisector, i.e. how far away it is from (p + q)/2, using basic trigonometry. Let m = (p + q)/2, and consider the triangle △pmu. The side lengths of this triangle are |pm| = |s|/2, |mu| ≔ b, and |up| ≔ c. Let us first compute c. We have cos(θ) = |pm|/|up| = |s|/(2c), and so c = |s|/(2cos(θ)). So, sin(θ) = |mu|/|up| = b/c, which gives b = csin(θ) = |s|sin(θ)/(2cos(θ)) = |s|tan(θ)/2. So, u is a distance |s|tan(θ)/2 from the midpoint. Notice that in the case θ = 30°, tan(θ) = √3/3, giving b = |s|√3/6 = |s|/(2√3), which is the same as the standard definition.
To test if a point r is inside the diametral lens with lens angle θ°, we simply have to check the angle at that point, i.e. the angle at r in the triangle pqr. If this angle is greater than 180° - 2θ°, then r is inside of the lens. This result comes from Shewchuk (2002). Note that this is the same as a diametral circle in the case θ° = 45°.
DelaunayTriangulation.is_ghost_vertex — Function
is_ghost_vertex(i) -> BoolTests if i is a ghost vertex, meaning i ≤ -1.
DelaunayTriangulation.is_boundary_edge — Function
is_boundary_edge(tri::Triangulation, ij) -> Bool
is_boundary_edge(tri::Triangulation, i, j) -> BoolTests if the edge (i, j) is a boundary edge of tri, meaning (j, i) adjoins a ghost vertex.
DelaunayTriangulation.is_boundary_triangle — Function
is_boundary_triangle(tri::Triangulation, T) -> Bool
is_boundary_triangle(tri::Triangulation, i, j, k) -> BoolReturns true if the triangle T = (i, j, k) of tri has an edge on the boundary, and false otherwise.
DelaunayTriangulation.is_ghost_edge — Function
is_ghost_edge(ij) -> Bool
is_ghost_edge(i, j) -> BoolTests if the edge (i, j) is a ghost edge, meaning i or j is a ghost vertex.
DelaunayTriangulation.is_ghost_triangle — Function
is_ghost_triangle(T) -> Bool
is_ghost_triangle(i, j, k) -> BoolTests if T = (i, j, k) is a ghost triangle, meaning i, j or k is a ghost vertex.
DelaunayTriangulation.is_boundary_node — Function
is_boundary_node(tri::Triangulation, i) -> (Bool, Vertex)Tests if the vertex i is a boundary node of tri.
Arguments
tri::Triangulation: TheTriangulation.i: The vertex to test.
Outputs
flag:trueifiis a boundary node, andfalseotherwise.g: Either the ghost vertex corresponding with the section thatilives on ifflagis true, or 0 otherwise.
DelaunayTriangulation.contains_segment — Function
contains_segment(tri::Triangulation, ij) -> Bool
contains_segment(tri::Triangulation, i, j) -> BoolReturns true if (i, j) is a segment in tri, and false otherwise. Both (i, j) and (j, i) are checked.
DelaunayTriangulation.contains_triangle — Function
contains_triangle(T, V) -> (Triangle, Bool)Check if the collection of triangles V contains the triangle T up to rotation. The Triangle returned is the triangle in V that is equal to T up to rotation, or T if no such triangle exists. The Bool is true if V contains T, and false otherwise.
Examples
julia> using DelaunayTriangulation
julia> V = Set(((1, 2, 3), (4, 5, 6), (7, 8, 9)))
Set{Tuple{Int64, Int64, Int64}} with 3 elements:
(7, 8, 9)
(4, 5, 6)
(1, 2, 3)
julia> DelaunayTriangulation.contains_triangle((1, 2, 3), V)
((1, 2, 3), true)
julia> DelaunayTriangulation.contains_triangle((2, 3, 1), V)
((1, 2, 3), true)
julia> DelaunayTriangulation.contains_triangle((10, 18, 9), V)
((10, 18, 9), false)
julia> DelaunayTriangulation.contains_triangle(9, 7, 8, V)
((7, 8, 9), true)DelaunayTriangulation.edge_exists — Function
edge_exists(tri::Triangulation, ij) -> Bool
edge_exists(tri::Triangulation, i, j) -> BoolTests if the edge (i, j) is in tri, returning true if so and false otherwise.
See also unoriented_edge_exists.
DelaunayTriangulation.unoriented_edge_exists — Function
unoriented_edge_exists(tri::Triangulation, ij) -> Bool
unoriented_edge_exists(tri::Triangulation, i, j) -> BoolTests if the unoriented edge (i, j) is in tri, returning true if so and false otherwise.
DelaunayTriangulation.has_ghost_triangles — Function
has_ghost_triangles(tri::Triangulation) -> BoolReturns true if tri has ghost triangles, and false otherwise.
DelaunayTriangulation.is_constrained — Function
is_constrained(tri::Triangulation) -> BoolReturns true if tri has constrained edges (segments), and false otherwise.
DelaunayTriangulation.has_multiple_curves — Function
has_multiple_curves(boundary_nodes) -> BoolCheck if boundary_nodes has multiple curves.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.has_multiple_curves([1, 2, 3, 1])
false
julia> DelaunayTriangulation.has_multiple_curves([[1, 2, 3], [3, 4, 1]])
false
julia> DelaunayTriangulation.has_multiple_curves([[[1, 2, 3], [3, 4, 1]], [[5, 6, 7, 8, 5]]])
trueDelaunayTriangulation.has_multiple_sections — Function
has_multiple_sections(boundary_nodes) -> BoolCheck if boundary_nodes has multiple sections.
Examples
julia> using DelaunayTriangulation
julia> DelaunayTriangulation.has_multiple_sections([1, 2, 3, 1])
false
julia> DelaunayTriangulation.has_multiple_sections([[1, 2, 3], [3, 4, 1]])
true
julia> DelaunayTriangulation.has_multiple_sections([[[1, 2, 3], [3, 4, 1]], [[5, 6, 7, 8, 5]]])
trueDelaunayTriangulation.has_boundary_nodes — Function
has_boundary_nodes(tri::Triangulation) -> BoolReturns true if tri has boundary nodes, and false otherwise.
DelaunayTriangulation.is_weighted — Function
is_weighted(weights) -> BoolReturns true if weights represents a set of weights that are not all zero, and false otherwise. Note that even for vectors like zeros(n), this will return true; by default, false is returned only for weights = ZeroWeight().
is_weighted(tri::Triangulation) -> BoolReturns true if tri is weighted, and false otherwise.
is_weighted(vorn::VoronoiTessellation) -> BoolReturns true if the Voronoi tessellation vorn is weighted, and false otherwise.
DelaunayTriangulation.is_negativelyoriented — Function
is_negativelyoriented(cert::Certificate) -> BoolReturns true if cert is NegativelyOriented, and false otherwise.
DelaunayTriangulation.is_positivelyoriented — Function
is_positivelyoriented(cert::Certificate) -> BoolReturns true if cert is PositivelyOriented, and false otherwise.