C# Class HyperbolicModels.SphericalTrig

Show file Open project: roice3/Honeycombs Class Usage Examples

Public Methods

Method Description
IntersectionCircleCircle ( Vector3D sphereCenter, Circle3D c1, Circle3D c2, Vector3D &i1, Vector3D &i2 ) : void

NOTE: Not general, and assumes some things we know about this problem domain, e.g. that c1 and c2 live on the same sphere of radius 1, and have two intersection points.

IntersectionGCGC ( Vector3D gc1, Vector3D gc2, Vector3D &i1, Vector3D &i2 ) : bool

Returns the two intersection points of two great circles. gc1 and gc2 are the great circle normal vectors. Fails if the input circles are the same.

IntersectionSmart ( Vector3D sphereCenter, Circle3D c1, Circle3D c2, Vector3D &i1, Vector3D &i2 ) : bool

Had to break the intersection method into separate cases (depending on when circles are great circles or not), because the spherical pythagorean theorem breaks down in GC cases.

Private Methods

Method Description
Clamp ( double val ) : double

Clamps the input to [-1,1]. This is to avoid floating point issues when taking arcsin and arccos.

CosAngle ( Vector3D p1, Vector3D p2 ) : double

Calculate the cosine of the angle between two vectors.

GetGCNormal ( Vector3D p1, Vector3D p2, Vector3D &normal ) : bool

Return the normal of the great circle defined by the two vectors. Return false if we fail to get the normal (happens if p1 = p2).

IntersectionCircleGC ( Circle3D c, Vector3D gc, List iPoints ) : bool

Returns intersection points between a circle and a great circle. There may be 0, 1, or 2 intersection points. Returns false if the circle is the same as gc.

IsGC ( Circle3D c ) : bool
SinAngle ( Vector3D p1, Vector3D p2 ) : double

Calculate the sine of the angle between two vectors.

Method Details

IntersectionCircleCircle() public static method

NOTE: Not general, and assumes some things we know about this problem domain, e.g. that c1 and c2 live on the same sphere of radius 1, and have two intersection points.
public static IntersectionCircleCircle ( Vector3D sphereCenter, Circle3D c1, Circle3D c2, Vector3D &i1, Vector3D &i2 ) : void
sphereCenter Vector3D
c1 R3.Geometry.Circle3D
c2 R3.Geometry.Circle3D
i1 Vector3D
i2 Vector3D
return void

IntersectionGCGC() public static method

Returns the two intersection points of two great circles. gc1 and gc2 are the great circle normal vectors. Fails if the input circles are the same.
public static IntersectionGCGC ( Vector3D gc1, Vector3D gc2, Vector3D &i1, Vector3D &i2 ) : bool
gc1 Vector3D
gc2 Vector3D
i1 Vector3D
i2 Vector3D
return bool

IntersectionSmart() public static method

Had to break the intersection method into separate cases (depending on when circles are great circles or not), because the spherical pythagorean theorem breaks down in GC cases.
public static IntersectionSmart ( Vector3D sphereCenter, Circle3D c1, Circle3D c2, Vector3D &i1, Vector3D &i2 ) : bool
sphereCenter Vector3D
c1 R3.Geometry.Circle3D
c2 R3.Geometry.Circle3D
i1 Vector3D
i2 Vector3D
return bool