Table of Contents

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 CoordinateSystem3D

coordinate 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 double

arc radius

angleRadStart double

arc angle start (rad). is not required that start angle less than end. It will normalized 0-2pi

angleRadEnd double

arc 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 Vector3D

first constraint point

p2 Vector3D

second constraint point

p3 Vector3D

third 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 double
cs CoordinateSystem3D
r double
from Vector3D
to 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 double

length tolerance

fromPt Vector3D

arc start point

insidePt Vector3D

arc inside point (ideally midpoint)

toPt Vector3D

arc end point

Properties

A0ProgeCadScript

public string A0ProgeCadScript { get; }

Property Value

string

A0QCadScript

public string A0QCadScript { get; }

Property Value

string

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

double

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

double

AngleEndDeg

public double AngleEndDeg { get; }

Property Value

double

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

double

AngleStartDeg

public double AngleStartDeg { get; }

Property Value

double

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

CoordinateSystem3D

Center

public Vector3D Center { get; }

Property Value

Vector3D

ChordTriangleArea

Area of chord triangle

public double ChordTriangleArea { get; }

Property Value

double

CircularSectorArea

Area of circular sector

public double CircularSectorArea { get; }

Property Value

double

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

Vector3D

GeomFrom

start point

public override Vector3D GeomFrom { get; }

Property Value

Vector3D

GeomTo

end point

public override Vector3D GeomTo { get; }

Property Value

Vector3D

Length

Length of Arc from start to end

public override double Length { get; }

Property Value

double

MidPoint

mid point eval as arc point at angle start + arc angle/2

public override Vector3D MidPoint { get; }

Property Value

Vector3D

Radius

radius of arc

public double Radius { get; }

Property Value

double

Segment

return From,To segment

public Line3D Segment { get; }

Property Value

Line3D

SegmentArea

Segment area ( CircularSectorArea - ChordTriangleArea )

public double SegmentArea { get; }

Property Value

double

SensedAngleEnd

public double SensedAngleEnd { get; }

Property Value

double

SensedAngleEndDeg

public double SensedAngleEndDeg { get; }

Property Value

double

SensedAngleStart

public double SensedAngleStart { get; }

Property Value

double

SensedAngleStartDeg

public double SensedAngleStartDeg { get; }

Property Value

double

To

point at angle end

public Vector3D To { get; }

Property Value

Vector3D

Vertexes

vertexes of this geom ( can be 1 for points, 2 for line/arc/circles )

public override IEnumerable<Vector3D> Vertexes { get; }

Property Value

IEnumerable<Vector3D>

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

BBox3D

Bulge(double)

public double Bulge(double tol)

Parameters

tol double

length tolerance

Returns

double

arc buldge value

CentreOfMass(out double)

centre of mass of circular segment

public Vector3D CentreOfMass(out double A)

Parameters

A double

arc 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 double

length tolerance

pt Vector3D

point to check

onlyPerimeter bool

if true it checks if point is on perimeter; if false it will check in area too

Returns

bool

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 double

len tolerance

pt Vector3D

point to test

inArcAngleRange bool

true if point angle must contained in arc angles, false to test like a circle

onlyPerimeter bool

true 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

Geometry

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 double

lines angles max

Returns

IEnumerable<Line3D>

Divide(int, bool)

split arc into pieces and retrieve split points ///

public override IEnumerable<Vector3D> Divide(int cnt, bool include_endpoints = false)

Parameters

cnt int

nr of piece

include_endpoints bool

if true returns also boundary points

Returns

IEnumerable<Vector3D>

EdgeContainsPoint(double, Vector3D)

States if edge contains given point on its perimeter

public override bool EdgeContainsPoint(double tol, Vector3D pt)

Parameters

tol double
pt Vector3D

Returns

bool

EqualsTol(double, Arc3D)

Checks if two arcs are equals ( it checks agains swapped from-to too )

public bool EqualsTol(double tol, Arc3D other)

Parameters

tol double

length tolerance

other Arc3D

other arc

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 double

length tolerance

other Geometry

other geom

checkSense bool

if false two geometry with different sense but same space coverage are considered equals

Returns

bool

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 Geometry
thisSegmentMode GeomSegmentMode

if this is Line3D specifies how to consider

otherSegmentMode GeomSegmentMode

if other is Line3D specifies how to consider

Returns

IEnumerable<Geometry>

Intersect(double, Arc3D, bool)

finds intersection points between two arcs

public IEnumerable<Vector3D> Intersect(double tol, Arc3D other, bool onlyPerimeter)

Parameters

tol double

length tolerance

other Arc3D

other arc

onlyPerimeter bool

true to test point contained only in perimeter, false to test also contained in area

Returns

IEnumerable<Vector3D>

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 double

len tolerance

cs CoordinateSystem3D

cs xy plane

onlyPerimeter bool

if false it will check in the arc area too, otherwise only on arc perimeter

inArcAngleRange bool

if 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 double

length tolerance

l Line3D

line

onlyPerimeter bool

check intersection only along perimeter; if false it will check intersection along arc area shape border too

lineSegmentMode bool

if 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 double

arc tolerance

l Line3D

line to test intersect

onlyPerimeter bool

check intersection only along perimeter; if false it will check intersection along arc area shape border too

lineSegmentMode bool

if true line treat as segment instead of infinite

arcSegmentMode bool

if true arc treat as circle

Returns

IEnumerable<Vector3D>

Move(Vector3D)

create an arc copy with origin moved

public override Geometry Move(Vector3D delta)

Parameters

delta Vector3D

new arc origin delta

Returns

Geometry

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

tol double
end EdgeEnd
newEnd Vector3D

Returns

Edge

Offset(double, Vector3D, double)

create offseted arc toward refPt for given offset.

public override Edge Offset(double tol, Vector3D refPt, double offset)

Parameters

tol double
refPt Vector3D
offset double

Returns

Edge

Perpendicular(double, Vector3D)

Build a perpendicular vector to this arc starting from the given point p.

public Line3D? Perpendicular(double tol, Vector3D p)

Parameters

tol double
p Vector3D

Returns

Line3D

ProgeCadScript(bool)

public override string ProgeCadScript(bool final = true)

Parameters

final bool

Returns

string

Project(double, Plane3D)

project this arc to given projection plane

public override Edge Project(double tol, Plane3D prjPlane)

Parameters

tol double
prjPlane Plane3D

Returns

Edge

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

tol double
p Vector3D
arcSegmentMode bool

Returns

Vector3D

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

tol double

length tolerance

pt Vector3D

point to query angle respect csx axis for

Returns

double

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

Vector3D

QCadScript(bool)

qcad 2d script

public override string QCadScript(bool final = true)

Parameters

final bool

adds QQ command

Returns

string

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 double

length tolerance

breaks IEnumerable<Vector3D>

Returns

IEnumerable<Geometry>

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 double

arc length tolerance

_splitPts IEnumerable<Vector3D>

point where split arc

validate_pts bool

if true split only for split points on arc perimeter

Returns

IEnumerable<Arc3D>

ToCircle3D(double)

public Circle3D ToCircle3D(double tol)

Parameters

tol double

Returns

Circle3D

ToString()

public override string ToString()

Returns

string

ToString(int)

public override string ToString(int digits = 3)

Parameters

digits int

Returns

string

ToggleSense()

public Arc3D ToggleSense()

Returns

Arc3D