Class CoordinateSystem3D
- Namespace
- SearchAThing.Sci
- Assembly
- netcore-sci.dll
CS with origin and basex, basey, basez orthonormal vectors. WCS coord can be translated to this cs using ToUCS() method. UCS coord can be translated back to wcs using ToWCS() method.
public class CoordinateSystem3D
- Inheritance
-
CoordinateSystem3D
- Inherited Members
Constructors
CoordinateSystem3D(Vector3D, Vector3D, CoordinateSystem3DAutoEnum)
build coordinate system with given origin and given BaseZ on given vector normal; given normal will subjected to normalization; depending on csAutoType one or another arbitrary axis alghoritm will used to build cs from a point and a normal.
public CoordinateSystem3D(Vector3D o, Vector3D normal, CoordinateSystem3DAutoEnum csAutoType = CoordinateSystem3DAutoEnum.AAA)
Parameters
o
Vector3Dorigin of cs
normal
Vector3DZ vector of cs
csAutoType
CoordinateSystem3DAutoEnumauto cs type
CoordinateSystem3D(Vector3D, Vector3D, Vector3D, SmartCsMode)
Construct a right-hand coordinate system with the given origin and two vector ( not required to be normalized, nor orthogonal ).
public CoordinateSystem3D(Vector3D o, Vector3D v1, Vector3D v2, SmartCsMode mode = SmartCsMode.X_YQ)
Parameters
o
Vector3Dcs origin
v1
Vector3Dfirst vector
v2
Vector3Dsecond vector
mode
SmartCsModespecify how to consider first and second vector to build the cs
CoordinateSystem3D(Vector3D, Vector3D, Vector3D, Vector3D)
construct a coordinate system with the given origin and orthonormal bases note that given bases MUST already normalized
public CoordinateSystem3D(Vector3D o, Vector3D baseX, Vector3D baseY, Vector3D baseZ)
Parameters
o
Vector3Dcs origin
baseX
Vector3Dcs X base ( must already normalized )
baseY
Vector3Dcs Y base ( must already normalized )
baseZ
Vector3Dcs Z base ( must already normalized )
Fields
WCS
world cs : basex=(1,0,0) basey=(0,1,0) basez=(0,0,1)
public static readonly CoordinateSystem3D WCS
Field Value
Remarks
XY
right handed XY ( Z ) : top view
public static readonly CoordinateSystem3D XY
Field Value
XZ
right handed XZ ( -Y ) : front view
public static readonly CoordinateSystem3D XZ
Field Value
YZ
right handed YZ ( X ) : side view
public static readonly CoordinateSystem3D YZ
Field Value
Properties
BaseX
cs x versor ( normalized )
public Vector3D BaseX { get; }
Property Value
BaseY
cs y versor ( normalized )
public Vector3D BaseY { get; }
Property Value
BaseZ
cs z versor ( normalized )
public Vector3D BaseZ { get; }
Property Value
CadScript
script to paste in cad ( axis length = 1 )
public string CadScript { get; }
Property Value
Origin
origin of cs where x,y,z base vectors applied
public Vector3D Origin { get; }
Property Value
csAutoType
not null if this cs basex, basey honors cs auto type rule
public CoordinateSystem3DAutoEnum? csAutoType { get; }
Property Value
Methods
Contains(double, Vector3D, bool)
verify if this cs XY plane contains given wcs point
public bool Contains(double tol, Vector3D point, bool evalCSOrigin = true)
Parameters
tol
doublecalc tolerance
point
Vector3Dpoint to verify
evalCSOrigin
boolif true CS origin will subtracted before transform test
Returns
- bool
true if point contained in cs, else otherwise
Equals(double, CoordinateSystem3D)
verify is this cs is equals to otherByLayer ( same origin, x, y, z base vectors )
public bool Equals(double tol, CoordinateSystem3D other)
Parameters
tol
doublecalc tolerance ( for origin check )
other
CoordinateSystem3Dcs to check equality against
Returns
- bool
true if this cs equals the given on, false otherwise
Remarks
FlipX()
retrieve a new cs with same origin but basex flipped (Origin, -BaseX, BaseY, -BaseZ)
public CoordinateSystem3D FlipX()
Returns
FlipY()
retrieve a new cs with same origin but basey flipped (Origin, BaseX, -BaseY, -BaseZ)
public CoordinateSystem3D FlipY()
Returns
FlipZ()
retrieve a new cs with same origin but basez inverted (Origin, BaseX, -BaseY, -BaseZ)
public CoordinateSystem3D FlipZ()
Returns
Intersect(double, CoordinateSystem3D)
return intersect line between two cs xy planes
public Line3D? Intersect(double tol, CoordinateSystem3D other)
Parameters
tol
doublelen tolernace
other
CoordinateSystem3Dother cs
Returns
- Line3D
null if cs parallel to the given other
IsParallelTo(double, CoordinateSystem3D)
states if this cs have Z base parallel to the other given cs
public bool IsParallelTo(double tol, CoordinateSystem3D other)
Parameters
tol
doubleother
CoordinateSystem3D
Returns
Move(Vector3D)
return another cs with origin translated
public CoordinateSystem3D Move(Vector3D delta)
Parameters
delta
Vector3D
Returns
Rotate(Line3D, double)
return another cs rotated respect given axis
public CoordinateSystem3D Rotate(Line3D axis, double angleRad)
Parameters
Returns
Rotate(Vector3D, double)
return another cs with same origin and base vector rotated about given vector
public CoordinateSystem3D Rotate(Vector3D vectorAxis, double angleRad)
Parameters
Returns
RotateAs(double, Vector3D, Vector3D)
return another cs rotated as from goes toward to
public CoordinateSystem3D RotateAs(double tol, Vector3D from, Vector3D to)
Parameters
Returns
Simplified()
if BaseZ matches one of XY, XZ, YZ default cs then a new cs with origin preserved but baseX, baseY, baseZ overriden will returned.
public CoordinateSystem3D Simplified()
Returns
ToCadString(double)
script to paste in cad to draw cs rgb mode ( x=red, y=green, z=blue )
public string ToCadString(double axisLen)
Parameters
axisLen
doublelength of x,y,z axes
Returns
- string
cad script
ToDxfLines(double)
retrieve a set of 3 dxf line (RED:x, GREEN:y, BLUE:z) representing CS
public IEnumerable<EntityObject> ToDxfLines(double len = 1)
Parameters
len
double
Returns
- IEnumerable<EntityObject>
ToDxfUCS(string)
public UCS ToDxfUCS(string name)
Parameters
name
string
Returns
- UCS
ToString()
public override string ToString()
Returns
ToString(int)
debug string
public string ToString(int digits)
Parameters
digits
int
Returns
- string
formatted representation of cs origin, x, y, z
ToUCS(Vector3D, bool)
Transform wcs point to given cs
public Vector3D ToUCS(Vector3D p, bool evalCSOrigin = true)
Parameters
p
Vector3Dwcs point
evalCSOrigin
boolif true CS origin will subtracted from wcs point before transform
Returns
ToWCS(Vector3D, bool)
transform ucs point to wcs
public Vector3D ToWCS(Vector3D p, bool evalCSOrigin = true)
Parameters
Returns
Transform(Matrix4x4)
create transformed CS by given transformation matrix
public CoordinateSystem3D Transform(Matrix4x4 m)