Table of Contents

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 Vector3D

origin of cs

normal Vector3D

Z vector of cs

csAutoType CoordinateSystem3DAutoEnum

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

cs origin

v1 Vector3D

first vector

v2 Vector3D

second vector

mode SmartCsMode

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

cs origin

baseX Vector3D

cs X base ( must already normalized )

baseY Vector3D

cs Y base ( must already normalized )

baseZ Vector3D

cs 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

CoordinateSystem3D

Remarks

XY

right handed XY ( Z ) : top view

public static readonly CoordinateSystem3D XY

Field Value

CoordinateSystem3D

XZ

right handed XZ ( -Y ) : front view

public static readonly CoordinateSystem3D XZ

Field Value

CoordinateSystem3D

YZ

right handed YZ ( X ) : side view

public static readonly CoordinateSystem3D YZ

Field Value

CoordinateSystem3D

Properties

BaseX

cs x versor ( normalized )

public Vector3D BaseX { get; }

Property Value

Vector3D

BaseY

cs y versor ( normalized )

public Vector3D BaseY { get; }

Property Value

Vector3D

BaseZ

cs z versor ( normalized )

public Vector3D BaseZ { get; }

Property Value

Vector3D

CadScript

script to paste in cad ( axis length = 1 )

public string CadScript { get; }

Property Value

string

Origin

origin of cs where x,y,z base vectors applied

public Vector3D Origin { get; }

Property Value

Vector3D

csAutoType

not null if this cs basex, basey honors cs auto type rule

public CoordinateSystem3DAutoEnum? csAutoType { get; }

Property Value

CoordinateSystem3DAutoEnum?

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 double

calc tolerance

point Vector3D

point to verify

evalCSOrigin bool

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

calc tolerance ( for origin check )

other CoordinateSystem3D

cs 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

CoordinateSystem3D

FlipY()

retrieve a new cs with same origin but basey flipped (Origin, BaseX, -BaseY, -BaseZ)

public CoordinateSystem3D FlipY()

Returns

CoordinateSystem3D

FlipZ()

retrieve a new cs with same origin but basez inverted (Origin, BaseX, -BaseY, -BaseZ)

public CoordinateSystem3D FlipZ()

Returns

CoordinateSystem3D

Intersect(double, CoordinateSystem3D)

return intersect line between two cs xy planes

public Line3D? Intersect(double tol, CoordinateSystem3D other)

Parameters

tol double

len tolernace

other CoordinateSystem3D

other 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 double
other CoordinateSystem3D

Returns

bool

Move(Vector3D)

return another cs with origin translated

public CoordinateSystem3D Move(Vector3D delta)

Parameters

delta Vector3D

Returns

CoordinateSystem3D

Rotate(Line3D, double)

return another cs rotated respect given axis

public CoordinateSystem3D Rotate(Line3D axis, double angleRad)

Parameters

axis Line3D
angleRad double

Returns

CoordinateSystem3D

Rotate(Vector3D, double)

return another cs with same origin and base vector rotated about given vector

public CoordinateSystem3D Rotate(Vector3D vectorAxis, double angleRad)

Parameters

vectorAxis Vector3D
angleRad double

Returns

CoordinateSystem3D

RotateAs(double, Vector3D, Vector3D)

return another cs rotated as from goes toward to

public CoordinateSystem3D RotateAs(double tol, Vector3D from, Vector3D to)

Parameters

tol double
from Vector3D
to Vector3D

Returns

CoordinateSystem3D

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

CoordinateSystem3D

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 double

length 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

string

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 Vector3D

wcs point

evalCSOrigin bool

if true CS origin will subtracted from wcs point before transform

Returns

Vector3D

ToWCS(Vector3D, bool)

transform ucs point to wcs

public Vector3D ToWCS(Vector3D p, bool evalCSOrigin = true)

Parameters

p Vector3D

ucs point

evalCSOrigin bool

if true CS origin will added after transform

Returns

Vector3D

Transform(Matrix4x4)

create transformed CS by given transformation matrix

public CoordinateSystem3D Transform(Matrix4x4 m)

Parameters

m Matrix4x4

Returns

CoordinateSystem3D