ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
active::geometry::PolyEdge Class Reference

#include <PolyEdge.h>

Collaboration diagram for active::geometry::PolyEdge:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<PolyEdge>
 Unique pointer.
 
using Shared = std::shared_ptr<PolyEdge>
 Shared pointer.
 
using Option = std::optional<PolyEdge>
 Optional.
 

Public Member Functions

 PolyEdge ()
 
 PolyEdge (const Point &origin, const PolyPoint &end)
 
 PolyEdge (const Point &origin, const Point &end, double radius, Rotation rotation=anticlockwise, double prec=math::eps)
 
 PolyEdge (const Arc &arc)
 
bool operator== (const PolyEdge &ref) const
 The normal to the plane the edge is aligned to (vertical by default)
 
bool operator!= (const PolyEdge &ref) const
 
PolyEdgeoperator= (const PolyEdge &source)
 
PolyEdge operator+ (const Point &offset) const
 
PolyEdgeoperator+= (const Point &offset)
 
PolyEdge operator- (const Point &offset) const
 
PolyEdgeoperator-= (const Point &offset)
 
PolyEdge operator* (double scale) const
 
PolyEdgeoperator*= (double scale)
 
PolyEdge operator* (const Matrix3x3 &matrix) const
 
PolyEdgeoperator*= (const Matrix3x3 &matrix)
 
bool isArc (double prec=math::eps) const
 
bool isEqual2D (const PolyEdge &ref, double prec=math::eps) const
 
bool isEqual3D (const PolyEdge &ref, double prec=math::eps) const
 
bool isColinearTo2D (const PolyEdge &ref, double prec=math::eps) const
 
bool isColinearTo3D (const PolyEdge &ref, double prec=math::eps) const
 
bool isParallelTo2D (const PolyEdge &ref, double prec=math::eps) const
 
bool isParallelTo3D (const PolyEdge &ref, double prec=math::eps) const
 
bool isTangentialTo2D (const PolyEdge &ref, double prec=math::eps, double anglePrec=math::epsAngle) const
 
double getRadius (bool isSigned=false) const
 
double getSweep () const
 
double azimuthAngle () const
 
double altitudeAngle () const
 
double startTangent () const
 
double endTangent () const
 
double getTangentAt (const Point &ref) const
 
Point centre () const
 
Point midpoint () const
 
double getArea (bool isResultSigned=false) const
 
double length2D () const
 
double length3D () const
 
std::optional< ArcasArc (double prec=math::eps) const
 
Point closestPointTo2D (const Point &ref, double prec=math::eps) const
 
Point closestPointTo3D (const Point &ref, double prec=math::eps) const
 
Point closestPointAlong2D (const Point &ref, double prec=math::eps) const
 
Point closestPointAlong3D (const Point &ref, double prec=math::eps) const
 
vertex_index intersectionWith2D (const PolyEdge &ref, XList &inter, double prec=math::eps) const
 
vertex_index intersectionWith3D (const PolyEdge &ref, XList &inter, double prec=math::eps) const
 
Position positionOf2D (const Point &ref, double prec=math::eps) const
 
Position positionOf3D (const Point &ref, double prec=math::eps) const
 
bool encloses2D (const Point &ref, double prec=math::eps) const
 
bool encloses3D (const Point &ref, double prec=math::eps) const
 
bool overlaps2D (const PolyEdge &ref, double prec=math::eps) const
 
void setRadius (double radius, std::optional< Rotation > rotation=std::nullopt, double prec=math::eps)
 
void setSweep (double sweep)
 
void stretchOrigin (const Point &pt, bool canInvert=true, double prec=math::eps)
 
void stretchEnd (const Point &pt, double prec=math::eps)
 
void setBaseLevel (double z=0.0)
 
void offset (double shift)
 
void extend (double len, bool byEnd=true)
 
void extend (const Point &ref, bool byEnd=true)
 
void split (const Point &pos, PolyEdge &offcut, bool keepOrig=true)
 
void movePolar (double len, double azim, double alt)
 
void movePolar (double len, double angle)
 
PolyEdgeflip ()
 

Public Attributes

Point origin
 The edge origin.
 
PolyPoint end
 The edge end.
 
Vector3 normal = Vector3(0.0, 0.0, 1.0)
 The normal to the plane the edge lies in.
 

Detailed Description

Class to represent an edge (curved or straight)

Constructor & Destructor Documentation

◆ PolyEdge() [1/4]

active::geometry::PolyEdge::PolyEdge ( )
inline

Constructor

Here is the caller graph for this function:

◆ PolyEdge() [2/4]

PolyEdge::PolyEdge ( const Point & origin,
const PolyPoint & end )

Constructor

Parameters
originOrigin point of the edge
endEnd point of the edge

◆ PolyEdge() [3/4]

PolyEdge::PolyEdge ( const Point & origin,
const Point & end,
double radius,
Rotation rotation = anticlockwise,
double prec = math::eps )

Constructor

Parameters
originOrigin point of the edge
endEnd point of the edge
radiusThe edge radius (sign indicates arc centre side (+ve = right, -ve = left, 0 = linear)
rotationThe rotation direction of the edge
precThe required precision
Here is the call graph for this function:

◆ PolyEdge() [4/4]

PolyEdge::PolyEdge ( const Arc & arc)

Constructor

Parameters
arcAn arc describing the poly-edge

Member Function Documentation

◆ altitudeAngle()

double PolyEdge::altitudeAngle ( ) const

Get the altitude angle of the edge

Returns
The altitude angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ asArc()

Arc::Option PolyEdge::asArc ( double prec = math::eps) const

Get the edge as an arc

Parameters
precThe required precision
Returns
The edge as an arc (nullopt if the edge is not an arc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ azimuthAngle()

double PolyEdge::azimuthAngle ( ) const

Get the azimuth angle of the edge

Returns
The azimuth angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ centre()

Point PolyEdge::centre ( ) const

Get the center of the edge

Returns
The edge centre (centre of arc or midpoint of straight line)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointAlong2D()

Point PolyEdge::closestPointAlong2D ( const Point & ref,
double prec = math::eps ) const

Get the closest point along the edge to a given point in 2D

Parameters
refThe reference point
Returns
The closest point along the edge to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointAlong3D()

Point PolyEdge::closestPointAlong3D ( const Point & ref,
double prec = math::eps ) const

Get the closest point along the edge to a given point

Parameters
refThe reference point
Returns
The closest point along the edge to the reference point
Here is the call graph for this function:

◆ closestPointTo2D()

Point PolyEdge::closestPointTo2D ( const Point & ref,
double prec = math::eps ) const

Get the closest point in the edge to a given point in 2D

Parameters
refThe reference point
Returns
The closest point in the edge to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closestPointTo3D()

Point PolyEdge::closestPointTo3D ( const Point & ref,
double prec = math::eps ) const

Get the closest point in the edge to a given point

Parameters
refThe reference point
Returns
The closest point in the edge to the reference point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encloses2D()

bool PolyEdge::encloses2D ( const Point & ref,
double prec = math::eps ) const

Determine if a point is enclosed by a edge in 2D

Parameters
refThe reference point
precThe required precision
Returns
True if the edge encloses the point
Here is the call graph for this function:

◆ encloses3D()

bool PolyEdge::encloses3D ( const Point & ref,
double prec = math::eps ) const

Determine if a point is enclosed by a edge

Parameters
refThe reference point
Returns
True if the edge encloses the point
Here is the call graph for this function:

◆ endTangent()

double PolyEdge::endTangent ( ) const

Get the tangent angle at the edge end

Returns
The end tangent angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extend() [1/2]

void PolyEdge::extend ( const Point & ref,
bool byEnd = true )

Extend the edge to the point nearest te specified point

Parameters
refThe point to extend to
byEndTrue to extend the edge by the endpoint
Here is the call graph for this function:

◆ extend() [2/2]

void PolyEdge::extend ( double len,
bool byEnd = true )

Extend the edge length by the specified amount It is also possible to shorten the edge or to set len to negative values. If the edge is an arc, it cannot be extended further than to a full circle, both to the positive and to the negative direction.

Parameters
lenThe amount to extend the edge by
byEndTrue to extend the edge by the endpoint
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flip()

PolyEdge & PolyEdge::flip ( )

Flip the edge

Here is the caller graph for this function:

◆ getArea()

double PolyEdge::getArea ( bool isResultSigned = false) const

Get the edge area (line edges are always zero)

Parameters
isResultSignedTrue if the result should be signed (reflecting the arc angle)
Returns
The edge area
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRadius()

double PolyEdge::getRadius ( bool isSigned = false) const

Get the radius of the edge

Parameters
isSignedTrue if the radius should be signed for the side of arc centres (left = -ve, right = +ve)
Returns
The radius of the edge (0 = straight edge)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSweep()

double active::geometry::PolyEdge::getSweep ( ) const
inline

Get the edge sweep angle

Returns
The edge sweep angle (0.0 = straight line)

◆ getTangentAt()

double PolyEdge::getTangentAt ( const Point & ref) const

Get the tangent angle at the specified point

Parameters
refThe reference point
Returns
The tangent angle at the specified point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersectionWith2D()

vertex_index PolyEdge::intersectionWith2D ( const PolyEdge & ref,
XList & inter,
double prec = math::eps ) const

Get the intersection point of two edges in 2D

Parameters
refThe reference edge
interThe intersection list to populate
precThe required precision
Returns
The number of intersections calculated
Here is the call graph for this function:

◆ intersectionWith3D()

vertex_index PolyEdge::intersectionWith3D ( const PolyEdge & ref,
XList & inter,
double prec = math::eps ) const

Get the intersection point of two edges in 3D

Parameters
refThe reference edge
interThe intersection list to populate
precThe required precision
Returns
The number of intersections calculated
Here is the call graph for this function:

◆ isArc()

bool active::geometry::PolyEdge::isArc ( double prec = math::eps) const
inline

Determine if the edge is an arc

Returns
True if the edge is an arc
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isColinearTo2D()

bool PolyEdge::isColinearTo2D ( const PolyEdge & ref,
double prec = math::eps ) const

Check if two edges are colinear

Parameters
refThe reference edge
precThe required precision
Returns
True if the edges are colinear
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isColinearTo3D()

bool PolyEdge::isColinearTo3D ( const PolyEdge & ref,
double prec = math::eps ) const

Check if two edges are colinear

Parameters
refThe reference edge
Returns
True if the edges are colinear
Here is the call graph for this function:

◆ isEqual2D()

bool PolyEdge::isEqual2D ( const PolyEdge & ref,
double prec = math::eps ) const

Determine if two edges are equal in 2D

Parameters
refThe edge to compare with this
precThe required precision
Returns
True if the edges are identical
Here is the call graph for this function:

◆ isEqual3D()

bool PolyEdge::isEqual3D ( const PolyEdge & ref,
double prec = math::eps ) const

Determine if two edges are equal

Parameters
refThe edge to compare with this
precThe required precision
Returns
True if the edges are identical
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParallelTo2D()

bool PolyEdge::isParallelTo2D ( const PolyEdge & ref,
double prec = math::eps ) const

Check if two edges are parallel

Parameters
refThe reference edge
precThe required precision
Returns
True if they are parallel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isParallelTo3D()

bool PolyEdge::isParallelTo3D ( const PolyEdge & ref,
double prec = math::eps ) const

Check if two edges are parallel

Parameters
refThe reference edge
Returns
True if the edges are parallel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTangentialTo2D()

bool PolyEdge::isTangentialTo2D ( const PolyEdge & ref,
double prec = math::eps,
double anglePrec = math::epsAngle ) const

Check if two edges are tangential (i.e. the end tangent of the reference edge matches the start tangent of this edge)

Parameters
refThe reference edge
precThe coordinate precision
anglePrecThe angle precision
Returns
True if the edges are tangential
Here is the call graph for this function:
Here is the caller graph for this function:

◆ length2D()

double PolyEdge::length2D ( ) const

Get the length of the edge in 2D

Returns
The 2D edge length
Here is the call graph for this function:
Here is the caller graph for this function:

◆ length3D()

double PolyEdge::length3D ( ) const

Get the length of the edge

Returns
The length of the edge
Here is the call graph for this function:
Here is the caller graph for this function:

◆ midpoint()

Point PolyEdge::midpoint ( ) const

Get the midpoint of the edge

Returns
The midpoint of the edge
Here is the call graph for this function:
Here is the caller graph for this function:

◆ movePolar() [1/2]

void PolyEdge::movePolar ( double len,
double angle )

Move the edge by the specified distance and angle

Parameters
lenThe distance to move the edge
angleThe angle to move the edge along
Here is the call graph for this function:

◆ movePolar() [2/2]

void PolyEdge::movePolar ( double len,
double azim,
double alt )

Move the edge by the specified distance and azimuth/altitude angles

Parameters
lenThe distance to move the edge
azimThe azimuth angle to move the edge along
altThe altitude angle to move the edge along
Here is the call graph for this function:

◆ offset()

void PolyEdge::offset ( double shift)

Offset the edge by the specified amount

Parameters
shiftThe amount to offset the edge by
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool active::geometry::PolyEdge::operator!= ( const PolyEdge & ref) const
inline

Inequality operator

Parameters
refThe edge to compare with this
Returns
True if the edges are different
Here is the call graph for this function:

◆ operator*() [1/2]

PolyEdge PolyEdge::operator* ( const Matrix3x3 & matrix) const

Multiplication operator

Parameters
matrixThe matrix to multiply the edge by
Returns
A multiplied edge
Here is the call graph for this function:

◆ operator*() [2/2]

PolyEdge PolyEdge::operator* ( double scale) const

Multiplication operator

Parameters
scaleThe amount to multiply the edge by
Returns
A multiplied edge
Here is the call graph for this function:

◆ operator*=() [1/2]

PolyEdge & PolyEdge::operator*= ( const Matrix3x3 & matrix)

Multiplication with assignment operator

Parameters
matrixThe matrix to multiply the edge by
Returns
A reference to this

◆ operator*=() [2/2]

PolyEdge & PolyEdge::operator*= ( double scale)

Multiplication with assignment operator

Parameters
scaleThe amount to multiply the edge by
Returns
A reference to this

◆ operator+()

PolyEdge PolyEdge::operator+ ( const Point & offset) const

Addition operator

Parameters
offsetThe amount to add to the edge
Returns
An offset edge
Here is the call graph for this function:

◆ operator+=()

PolyEdge & PolyEdge::operator+= ( const Point & offset)

Addition with assignment operator

Parameters
offsetThe amount to add to the edge
Returns
A reference to this
Here is the call graph for this function:

◆ operator-()

PolyEdge PolyEdge::operator- ( const Point & offset) const

Subtraction operator

Parameters
offsetThe amount to subtract from the edge
Returns
An offset edge
Here is the call graph for this function:

◆ operator-=()

PolyEdge & PolyEdge::operator-= ( const Point & offset)

Subtraction with assignment operator

Parameters
offsetThe amount to subtract from the edge
Returns
A reference to this
Here is the call graph for this function:

◆ operator=()

PolyEdge & PolyEdge::operator= ( const PolyEdge & source)

Assignment operator

Parameters
sourceThe edge to be assigned to this
Returns
A reference to this edge

◆ operator==()

bool active::geometry::PolyEdge::operator== ( const PolyEdge & ref) const
inline

The normal to the plane the edge is aligned to (vertical by default)

Equality operator

Parameters
refThe edge to compare with this
Returns
True if the edges are identical
Here is the call graph for this function:

◆ overlaps2D()

bool PolyEdge::overlaps2D ( const PolyEdge & ref,
double prec = math::eps ) const

Determine if this edge is overlapped by a reference edge (a touching vertex is not an overlap)

Parameters
refThe reference edge
precThe required precision
Returns
True if the edge overlaps the reference edge
Here is the call graph for this function:

◆ positionOf2D()

Position PolyEdge::positionOf2D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the edge in 2D

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ positionOf3D()

Position PolyEdge::positionOf3D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the edge in 3D

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBaseLevel()

void PolyEdge::setBaseLevel ( double z = 0.0)

Set the level (z coordinate) of the edge vertices

Parameters
zThe required level

◆ setRadius()

void PolyEdge::setRadius ( double radius,
std::optional< Rotation > rotation = std::nullopt,
double prec = math::eps )

Set the edge radius

Parameters
radiusThe edge radius (sign indicates arc centre side (+ve = right, -ve = left, 0 = linear)
rotationThe rotation direction of the edge (undefined = use existing, default = anticlockwise)
precThe required precision
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSweep()

void active::geometry::PolyEdge::setSweep ( double sweep)
inline

Set the edge sweep angle

Parameters
sweepThe edge sweep angle (0.0 = straight line)

◆ split()

void PolyEdge::split ( const Point & pos,
PolyEdge & offcut,
bool keepOrig = true )

Split the edge at the specified point

Parameters
posThe point to split the edge at
offcutThe offcut created by the split
keepOrigTrue to maintain the edge origin
Here is the call graph for this function:

◆ startTangent()

double PolyEdge::startTangent ( ) const

Get the tangent angle at the edge start

Returns
The start tangent angle
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stretchEnd()

void PolyEdge::stretchEnd ( const Point & pt,
double prec = math::eps )

Stretch the end point for this edge to the specified point

Parameters
ptThe point to stretch to
Here is the call graph for this function:

◆ stretchOrigin()

void PolyEdge::stretchOrigin ( const Point & pt,
bool canInvert = true,
double prec = math::eps )

Stretch the origin point for this edge to the specified point

Parameters
ptThe point to stretch to
canInvertTrue if the direction can be inverted
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: