Class Position
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
Class to describe a position object, that is a point in R^3, with reference information added.
[Serializable]
public class Position : ManualSerialization, IEquatable<IObjectBase>, ICloneable, ISerializable, IDeserializationCallback
- Inheritance
-
ObjectBaseSerializableObjectBaseManualSerializationPosition
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
Constructors
Position()
Default constructor, creating an absolute position of (0, 0, 0).
public Position()
Position(double, double, double, IProvidesPositioningReferences?, string)
Constructor to fill parameters.
public Position(double x, double y, double z, IProvidesPositioningReferences? positioningReferenceProvider, string positioningReferenceKey)
Parameters
xdoublex-coordinate
ydoubley-coordinate
zdoublez-coordinate
positioningReferenceProviderIProvidesPositioningReferencesThe object which provides the coordinate system that serves as reference for this position.
positioningReferenceKeystringKey for the coordinate system (contained by PositioningReferenceProvider) which shall serve as reference for this position.
Position(IProvidesPositioningReferences, string)
Constructor that creates a position in the origin of a given reference coordinate system.
public Position(IProvidesPositioningReferences positioningReferenceProvider, string positioningReferenceKey)
Parameters
positioningReferenceProviderIProvidesPositioningReferencesThe object which provides the coordinate system that serves as reference for this position.
positioningReferenceKeystringKey for the coordinate system (contained by PositioningReferenceProvider) which shall serve as reference for this position.
Position(Position)
Copy constructor.
public Position(Position pos)
Parameters
posPositionPosition to copy.
Position(Vector3D, IProvidesPositioningReferences?, string)
Constructor to fill parameters.
public Position(Vector3D coordinates, IProvidesPositioningReferences? positioningReferenceProvider, string positioningReferenceKey)
Parameters
coordinatesVector3DCoordinates of position.
positioningReferenceProviderIProvidesPositioningReferencesThe object which provides the coordinate system that serves as reference for this position.
positioningReferenceKeystringKey for the coordinate system (contained by PositioningReferenceProvider) which shall serve as reference for this position.
Properties
Coordinates
Gets and sets the position vector of the Position object.
public Vector3D Coordinates { get; set; }
Property Value
GetPositioningReference
Property to get the coordinate system that serves as reference for this object
public CartesianCoordinateSystem GetPositioningReference { get; }
Property Value
IsAbsolutePosition
Gets a flag, indicating whether the position is relative (false) to another coordinate system or absolute (true).
public bool IsAbsolutePosition { get; }
Property Value
IsUndefined
Gets whether the position is undefined.
public bool IsUndefined { get; }
Property Value
- bool
trueiff the Coordinates member is undefined.
PositioningReferenceKey
Gets or sets the key for the coordinate system (contained by PositioningReferenceProvider) which shall serve as reference for this position
public string PositioningReferenceKey { get; set; }
Property Value
PositioningReferenceProvider
Gets the object which provides the coordinate system that serves as reference for this position. It is to be set via the method SetPositioningReference().
public IProvidesPositioningReferences? PositioningReferenceProvider { get; }
Property Value
Methods
CalculateDistance(Position)
Calculates the absolute value of the distance from this position to another position
public double CalculateDistance(Position pos)
Parameters
posPositionPosition to calculate the distance to
Returns
- double
Distance to pos
Clone()
Clones the current object.
public override object Clone()
Returns
- object
Deep copy of this object.
Equals(object, EqualityIntent)
Determines whether the specified object is equal to this instance.
public override bool Equals(object obj, EqualityIntent equalityIntent)
Parameters
objobjectequalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or physical equality.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
SetPositioningReference(IProvidesPositioningReferences, string)
Method to set the PositioningReferenceProvider and the key for the coordinate system that serves as positioning reference
public void SetPositioningReference(IProvidesPositioningReferences referenceProvider, string key)
Parameters
referenceProviderIProvidesPositioningReferencesObject which provides the coordinate system that serves as reference for this position.
keystringKey for the coordinate system (contained by PositioningReferenceProvider) which shall serve as reference for this position
ToString()
Gives the coordinates of this position as String
public override string ToString()
Returns
Operators
operator ==(Position, Position)
Equality operator.
public static bool operator ==(Position pos1, Position pos2)
Parameters
Returns
- bool
Are both positions equal?
operator !=(Position, Position)
Inequality operator.
public static bool operator !=(Position pos1, Position pos2)
Parameters
Returns
- bool
Are both positions unequal?