Class Arc3D
- Namespace
- SearchAThing.Sci
- Assembly
- netcore-sci.dll
base geometry for arc 3d entities.
the CS origin is the Center of the arc. the CS basex, basey forms the arc plane.
angles start, end are normalized [0,2pi) measured as angle from the basex right-hand rotating around cs basez. the arc coverage goes from the angle start point toward angle end point right-hand rotating arond cs basez.
while the CS right hand rule allow to know the effective arc coverage Sense information allow to know the effective edge orientation.
public class Arc3D : Edge
- Inheritance
-
Arc3D
- Derived
- Inherited Members
Constructors
Arc3D(Arc3D)
build a copy of given arc
public Arc3D(Arc3D arc)
Parameters
arc
Arc3D
Arc3D(CoordinateSystem3D, double, double, double)
construct 3d arc
public Arc3D(CoordinateSystem3D cs, double r, double angleRadStart, double angleRadEnd)
Parameters
cs
CoordinateSystem3Dcoordinate system with origin at arc center, XY plane of cs contains the arc, angle is 0 at cs x-axis and increase right-hand around cs z-axis
r
doublearc radius
angleRadStart
doublearc angle start (rad). is not required that start angle less than end. It will normalized 0-2pi
angleRadEnd
doublearc angle end (rad). is not require that end angle great than start. It will normalized 0-2pi
Arc3D(Vector3D, Vector3D, Vector3D)
build 3d arc by given 3 points (angles 0,2pi)
protected Arc3D(Vector3D p1, Vector3D p2, Vector3D p3)
Parameters
p1
Vector3Dfirst constraint point
p2
Vector3Dsecond constraint point
p3
Vector3Dthird constraint point
Arc3D(double, CoordinateSystem3D, double, Vector3D, Vector3D)
build arc with given cs, radius goind from,to vectors
public Arc3D(double tol, CoordinateSystem3D cs, double r, Vector3D from, Vector3D to)
Parameters
tol
doublecs
CoordinateSystem3Dr
doublefrom
Vector3Dto
Vector3D
Arc3D(double, Vector3D, Vector3D, Vector3D)
Build arc by 3 given points.
Resulting simplified CS and normalized [0,2pi) AngleStart and AngleEnd will be choosen to meet follow requirements:
fromPt = CS.Origin + (Radius * CS.BaseX).RotateAboutAxis(CS.BaseZ, AngleStart) ;
toPt = CS.Origin + (Radius * CS.BaseX).RotateAboutAxis(CS.BaseZ, AngleEnd)
public Arc3D(double tol, Vector3D fromPt, Vector3D insidePt, Vector3D toPt)
Parameters
tol
doublelength tolerance
fromPt
Vector3Darc start point
insidePt
Vector3Darc inside point (ideally midpoint)
toPt
Vector3Darc end point
Properties
A0ProgeCadScript
public string A0ProgeCadScript { get; }
Property Value
A0QCadScript
public string A0QCadScript { get; }
Property Value
Angle
Arc (rad) angle length. angle between start-end or end-start depending on what start is less than end or not
public double Angle { get; }
Property Value
AngleEnd
end angle (rad) [0-2pi) respect cs xaxis rotating around cs zaxis note that start angle can be greather than end angle
public double AngleEnd { get; protected set; }
Property Value
AngleEndDeg
public double AngleEndDeg { get; }
Property Value
AngleStart
start angle (rad) [0-2pi) respect cs xaxis rotating around cs zaxis note that start angle can be greather than end angle
public double AngleStart { get; protected set; }
Property Value
AngleStartDeg
public double AngleStartDeg { get; }
Property Value
CS
coordinate system centered in arc center angle is 0 at X axis angle increase rotating right-hand on Z axis
public CoordinateSystem3D CS { get; }
Property Value
Center
public Vector3D Center { get; }
Property Value
ChordTriangleArea
Area of chord triangle
public double ChordTriangleArea { get; }
Property Value
CircularSectorArea
Area of circular sector
public double CircularSectorArea { get; }
Property Value
DxfEntity
dxf entity representing this geom
public override EntityObject DxfEntity { get; }
Property Value
- EntityObject
From
point at angle start
public Vector3D From { get; }
Property Value
GeomFrom
start point
public override Vector3D GeomFrom { get; }
Property Value
GeomTo
end point
public override Vector3D GeomTo { get; }
Property Value
Length
Length of Arc from start to end
public override double Length { get; }
Property Value
MidPoint
mid point eval as arc point at angle start + arc angle/2
public override Vector3D MidPoint { get; }
Property Value
Radius
radius of arc
public double Radius { get; }
Property Value
Segment
return From,To segment
public Line3D Segment { get; }
Property Value
SegmentArea
Segment area ( CircularSectorArea - ChordTriangleArea )
public double SegmentArea { get; }
Property Value
SensedAngleEnd
public double SensedAngleEnd { get; }
Property Value
SensedAngleEndDeg
public double SensedAngleEndDeg { get; }
Property Value
SensedAngleStart
public double SensedAngleStart { get; }
Property Value
SensedAngleStartDeg
public double SensedAngleStartDeg { get; }
Property Value
To
point at angle end
public Vector3D To { get; }
Property Value
Vertexes
vertexes of this geom ( can be 1 for points, 2 for line/arc/circles )
public override IEnumerable<Vector3D> Vertexes { get; }
Property Value
Methods
BBox(double)
compute wcs bbox executing a recursive bisect search of min and max
public override BBox3D BBox(double tol)
Parameters
tol
double
Returns
Bulge(double)
public double Bulge(double tol)
Parameters
tol
doublelength tolerance
Returns
- double
arc buldge value
CentreOfMass(out double)
centre of mass of circular segment
public Vector3D CentreOfMass(out double A)
Parameters
A
doublearc area
Returns
- Vector3D
location of arc centre of mass
Contains(double, Vector3D, bool)
states if given point relies on this arc perimeter or shape depending on arguments
public virtual bool Contains(double tol, Vector3D pt, bool onlyPerimeter)
Parameters
tol
doublelength tolerance
pt
Vector3Dpoint to check
onlyPerimeter
boolif true it checks if point is on perimeter; if false it will check in area too
Returns
Contains(double, Vector3D, bool, bool)
statis if given point contained in arc perimeter/shape or circle perimeter/shape depending on specified mode
protected bool Contains(double tol, Vector3D pt, bool inArcAngleRange, bool onlyPerimeter)
Parameters
tol
doublelen tolerance
pt
Vector3Dpoint to test
inArcAngleRange
booltrue if point angle must contained in arc angles, false to test like a circle
onlyPerimeter
booltrue to test point contained only in perimeter, false to test also contained in area
Returns
- bool
true if arc contains given pt
Copy()
create copy of this geometry.
public override Geometry Copy()
Returns
Remarks
it's required to call base.CopyFrom(other) to ensure geometry properties to be copied.
Discretize(double)
retrieve a discretized representation of this arc
public IEnumerable<Line3D> Discretize(double maxLineAngleRadStep)
Parameters
maxLineAngleRadStep
doublelines angles max
Returns
Divide(int, bool)
split arc into pieces and retrieve split points ///
public override IEnumerable<Vector3D> Divide(int cnt, bool include_endpoints = false)
Parameters
Returns
EdgeContainsPoint(double, Vector3D)
States if edge contains given point on its perimeter
public override bool EdgeContainsPoint(double tol, Vector3D pt)
Parameters
Returns
EqualsTol(double, Arc3D)
Checks if two arcs are equals ( it checks agains swapped from-to too )
public bool EqualsTol(double tol, Arc3D other)
Parameters
Returns
- bool
trus if two arcs equals
GeomEquals(double, Geometry, bool)
states if this geom equals to given other
public override bool GeomEquals(double tol, Geometry other, bool checkSense = false)
Parameters
tol
doublelength tolerance
other
Geometryother geom
checkSense
boolif false two geometry with different sense but same space coverage are considered equals
Returns
GeomIntersect(double, Geometry, GeomSegmentMode, GeomSegmentMode)
find intersections between this and another geometry resulting in zero or more geometries.
public override IEnumerable<Geometry> GeomIntersect(double tol, Geometry _other, GeomSegmentMode thisSegmentMode, GeomSegmentMode otherSegmentMode)
Parameters
tol
double_other
GeometrythisSegmentMode
GeomSegmentModeif this is Line3D specifies how to consider
otherSegmentMode
GeomSegmentModeif other is Line3D specifies how to consider
Returns
Intersect(double, Arc3D, bool)
finds intersection points between two arcs
public IEnumerable<Vector3D> Intersect(double tol, Arc3D other, bool onlyPerimeter)
Parameters
tol
doublelength tolerance
other
Arc3Dother arc
onlyPerimeter
booltrue to test point contained only in perimeter, false to test also contained in area
Returns
Intersect(double, CoordinateSystem3D, bool, bool)
find ips of intersect this arc to the given cs plane; return empty set if arc cs plane parallel to other given cs
public IEnumerable<Vector3D> Intersect(double tol, CoordinateSystem3D cs, bool onlyPerimeter, bool inArcAngleRange)
Parameters
tol
doublelen tolerance
cs
CoordinateSystem3Dcs xy plane
onlyPerimeter
boolif false it will check in the arc area too, otherwise only on arc perimeter
inArcAngleRange
boolif true find ips only for arc angle range
Returns
- IEnumerable<Vector3D>
sample
Remarks
Intersect(double, Line3D, bool, bool)
find ips of intersection between this arc and given line
public virtual IEnumerable<Vector3D> Intersect(double tol, Line3D l, bool onlyPerimeter, bool lineSegmentMode)
Parameters
tol
doublelength tolerance
l
Line3Dline
onlyPerimeter
boolcheck intersection only along perimeter; if false it will check intersection along arc area shape border too
lineSegmentMode
boolif true treat given line as segment; if false as infinite line
Returns
- IEnumerable<Vector3D>
intersection points between this arc and given line
Intersect(double, Line3D, bool, bool, bool)
states if this arc intersect given line
public IEnumerable<Vector3D> Intersect(double tol, Line3D l, bool onlyPerimeter, bool lineSegmentMode, bool arcSegmentMode)
Parameters
tol
doublearc tolerance
l
Line3Dline to test intersect
onlyPerimeter
boolcheck intersection only along perimeter; if false it will check intersection along arc area shape border too
lineSegmentMode
boolif true line treat as segment instead of infinite
arcSegmentMode
boolif true arc treat as circle
Returns
Move(Vector3D)
create an arc copy with origin moved
public override Geometry Move(Vector3D delta)
Parameters
delta
Vector3Dnew arc origin delta
Returns
MoveEnd(double, EdgeEnd, Vector3D)
extends edge endpoint toward new given one.
returns null if edge can't extends toward new given end.
public override Edge? MoveEnd(double tol, EdgeEnd end, Vector3D newEnd)
Parameters
Returns
Offset(double, Vector3D, double)
create offseted arc toward refPt for given offset.
public override Edge Offset(double tol, Vector3D refPt, double offset)
Parameters
Returns
Perpendicular(double, Vector3D)
Build a perpendicular vector to this arc starting from the given point p.
public Line3D? Perpendicular(double tol, Vector3D p)
Parameters
Returns
ProgeCadScript(bool)
public override string ProgeCadScript(bool final = true)
Parameters
final
bool
Returns
Project(double, Plane3D)
project this arc to given projection plane
public override Edge Project(double tol, Plane3D prjPlane)
Parameters
Returns
Project(double, Vector3D, bool)
project given point p to this arc.
returns null if ip falls outside arc perimeter and only_arc:true argument or p in the arc plane
public override Vector3D? Project(double tol, Vector3D p, bool arcSegmentMode = true)
Parameters
Returns
PtAngle(double, Vector3D)
return the angle (rad) of the point respect cs x axis rotating around cs z axis to reach given point angle alignment
public double PtAngle(double tol, Vector3D pt)
Parameters
Returns
PtAtAngle(double)
point on the arc circumnfere at given angle (rotating cs basex around cs basez) note: it start
public Vector3D PtAtAngle(double angleRad)
Parameters
angleRad
double
Returns
QCadScript(bool)
qcad 2d script
public override string QCadScript(bool final = true)
Parameters
final
booladds QQ command
Returns
Split(double, IEnumerable<Vector3D>)
returns this arc splitted by break points maintaining order from, to as this Start, End angle. precondition: breaks must lie on the arc angle range
public override IEnumerable<Geometry> Split(double tol, IEnumerable<Vector3D> breaks)
Parameters
tol
doublelength tolerance
breaks
IEnumerable<Vector3D>
Returns
Split(double, IEnumerable<Vector3D>, bool)
create a set of subarc from this by splitting through given split points split point are not required to be on perimeter of the arc ( a center arc to point line will split ) generated subarcs will start from this arc angleFrom and contiguosly end to angleTo
public IEnumerable<Arc3D> Split(double tol, IEnumerable<Vector3D> _splitPts, bool validate_pts = false)
Parameters
tol
doublearc length tolerance
_splitPts
IEnumerable<Vector3D>point where split arc
validate_pts
boolif true split only for split points on arc perimeter
Returns
ToCircle3D(double)
public Circle3D ToCircle3D(double tol)
Parameters
tol
double
Returns
ToString()
public override string ToString()
Returns
ToString(int)
public override string ToString(int digits = 3)
Parameters
digits
int
Returns
ToggleSense()
public Arc3D ToggleSense()