Click or drag to resize

Point Class

A point which may vary with time, defined relative to a given reference frame.
Inheritance Hierarchy

Namespace:  AGI.Foundation.Geometry
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax
public abstract class Point : DefinitionalObject, 
	IServiceProvider

The Point type exposes the following members.

Constructors
  NameDescription
Protected methodPoint
Initializes a new instance.
Protected methodPoint(Point, CopyContext)
Initializes a new instance as a copy of an existing instance.
Top
Properties
  NameDescription
Public propertyIsFrozen
Gets a value indicating whether this object is frozen. A frozen object cannot be modified and an ObjectFrozenException will be thrown if an attempt is made to do so.
(Inherited from DefinitionalObject.)
Public propertyStatic memberRoot
Gets the root point, which is not defined in terms of any reference frame.
Top
Methods
  NameDescription
Protected methodCheckForSameDefinition(DefinitionalObject)
Checks to determine if another instance has the same definition as this instance and returns if it does. Derived classes MUST override this method and check all new fields introduced by the derived class for definitional equivalence. It is NOT necessary to check base class fields because the base class will already have done that. When overriding this method, you should NOT call the base implementation because it will return for all derived-class instances. Derived classes should check the type of other to preserve the symmetric nature of IsSameDefinition(Object).
(Overrides DefinitionalObjectCheckForSameDefinition(DefinitionalObject).)
Protected methodCheckForSameDefinition(Point)
Checks to determine if another instance has the same definition as this instance and returns if it does. Derived classes MUST override this method and check all new fields introduced by the derived class for definitional equivalence. It is NOT necessary to check base class fields because the base class will already have done that. When overriding this method, you should NOT call the base implementation because it will return for all derived-class instances. Derived classes should check the type of other to preserve the symmetric nature of IsSameDefinition(Object).
Public methodClone
Clones this object using the specified context.
(Inherited from DefinitionalObject.)
Protected methodComputeCurrentDefinitionHashCode
Computes a hash code based on the current properties of this object. Derived classes MUST override this method and compute a hash code that combines: a unique hash code seed, the base implementation result, and the hash codes of all new fields introduced by the derived class which are used in the CheckForSameDefinition(DefinitionalObject) method.
(Overrides DefinitionalObjectComputeCurrentDefinitionHashCode.)
Public methodCreateVectorAcceleration
Constructs a vector which represents the second derivative of this point's position.
Public methodCreateVectorDerivative
Constructs a vector which represents the requested order of the derivative of this point's position.
Public methodCreateVectorVelocity
Constructs a vector which represents the derivative of this point's position.
Public methodEnumerateDependencies
Enumerates the dependencies of this object by calling EnumerateT(T) for each object that this object directly depends upon. Derived classes which contain additional dependencies MUST override this method, call the base implementation, and enumerate dependencies introduced by the derived class.
(Inherited from DefinitionalObject.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFreeze
Freezes this object. Further attempts to modify it will result in an ObjectFrozenException.
(Inherited from DefinitionalObject.)
Protected methodFreezeAggregatedObjects
Called by Freeze to also freeze any objects that are considered to be a part of this object. Derived classes which contain additional aggregated objects MUST override this method, call the base implementation, and freeze aggregated objects introduced by the derived class. The objects that need to be frozen in this method are frequently created in this object's constructor and are not settable via properties.
(Inherited from DefinitionalObject.)
Public methodGetDefinitionHashCode
Gets a hash code representing the definition of this object.
(Inherited from DefinitionalObject.)
Public methodGetEvaluator
Gets an evaluator that can be used to find the motion of this point in its parent reference frame at a given date. Consider using the methods of GeometryTransformer instead of calling this method directly. See GetEvaluator(EvaluatorGroup) for more details.
Public methodGetEvaluator(EvaluatorGroup)
Gets an evaluator that can be used to find the Motion<Cartesian> of this point at a given JulianDate. Adds the evaluator to the EvaluatorGroup.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetScalarElement(CartesianElement, ReferenceFrame)
Returns a Scalar representing the X, Y, Z, or Magnitude of this point.
Public methodGetScalarElement(CartesianElement, ReferenceFrame, Int32)
Returns a Scalar representing the X, Y, Z, or Magnitude, or any derivative of those elements of this point.
Public methodGetService
Gets the service object of the specified type.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsSameDefinition
Determines if this object has the same definition as another object.
(Inherited from DefinitionalObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodThrowIfFrozen
Throws ObjectFrozenException if this object IsFrozen. This method should be called from any method or property that modifies this object.
(Inherited from DefinitionalObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples

This example shows how to create a new Point class:

C#
// Create a new type derived from Point. This type will represent a point on the surface
// of a CentralBody formed by projecting another point onto the central body's ellipsoidal
// surface.
public class SurfacePoint : Point
{
    public SurfacePoint()
    {
    }

    public SurfacePoint(CentralBody centralBody, Point referencePoint)
    {
        m_centralBody = centralBody;
        m_referencePoint = referencePoint;
    }

    // The copy constructor, used to make a copy of the object. Copy all of the
    // fields of the 'existingInstance' to the new object. Reference types should
    // be passed through a call to UpdateReference so that the depth of the copy
    // can be controlled by the user. See the documentation of the ICloneWithContext
    // interface for more information.
    protected SurfacePoint(SurfacePoint existingInstance, CopyContext context)
        : base(existingInstance, context)
    {
        m_centralBody = context.UpdateReference(existingInstance.m_centralBody);
        m_referencePoint = context.UpdateReference(existingInstance.m_referencePoint);
    }

    // This is called to make a copy of the object, which it does by calling the
    // copy constructor above.
    public override object Clone(CopyContext context)
    {
        return new SurfacePoint(this, context);
    }

    // This method is only called by the IsSameDefinition method in the base class to
    // determine if two points are equivalent. Derived classes MUST override this method and
    // check all new fields introduced by the derived class for definitional equivalence. It
    // is NOT necessary to check base class fields because the base class will already have
    // done that.
    protected sealed override bool CheckForSameDefinition(Point other)
    {
        SurfacePoint o = other as SurfacePoint;
        return o != null &&
               AreSameDefinition(m_centralBody, o.m_centralBody) &&
               AreSameDefinition(m_referencePoint, o.m_referencePoint);
    }

    // Called to determine a hash code for the current configuration of this object.
    // Derived classes MUST override this method and compute a hash code that combines: 
    // a unique hash code seed, the base implementation result, and the 
    // hash codes of all new fields introduced by the derived class which are used 
    // in the CheckForSameDefinition method.
    protected override int ComputeCurrentDefinitionHashCode()
    {
        return HashCode.Combine(typeof(SurfacePoint).GetHashCode(),
                                base.ComputeCurrentDefinitionHashCode(),
                                GetDefinitionHashCode(m_centralBody),
                                GetDefinitionHashCode(m_referencePoint));
    }

    // Called to enumerate all of the other objects on which this object depends.  This
    // allows clients to navigate the graph of objects related to a computation.
    public override void EnumerateDependencies(DependencyEnumerator enumerator)
    {
        base.EnumerateDependencies(enumerator);
        enumerator.Enumerate(m_centralBody);
        enumerator.Enumerate(m_referencePoint);
    }

    // The central body on which to project the given ReferencePoint.
    public CentralBody CentralBody
    {
        get { return m_centralBody; }
        set { m_centralBody = value; }
    }

    // The reference point to be projected onto the surface of the central body.
    public Point ReferencePoint
    {
        get { return m_referencePoint; }
        set { m_referencePoint = value; }
    }

    // This method is responsible for returning an instance of the private
    // Evaluator class. It should ensure that the properties are not null or
    // in an invalid state and then use the evaluator group when it constructs
    // and returns an instance of the Evaluator.
    public override PointEvaluator GetEvaluator(EvaluatorGroup group)
    {
        if (group == null)
            throw new ArgumentNullException("group");

        // Ensure that the properties are not null.
        if (CentralBody == null)
            throw new PropertyInvalidException("CentralBody", PropertyInvalidException.PropertyCannotBeNull);
        if (ReferencePoint == null)
            throw new PropertyInvalidException("ReferencePoint", PropertyInvalidException.PropertyCannotBeNull);

        return group.CreateEvaluator<PointEvaluator>(CreateEvaluator);
    }

    // This method, which is passed to the evaluator group in the method above as a delegate,
    // will only be called if the evaluator does not yet exist in the group and needs to be created.
    private PointEvaluator CreateEvaluator(EvaluatorGroup group)
    {
        // In order to find the surface point, we're going to observe the reference point in the
        // central body's fixed frame and use methods on Ellipsoid to find the surface point.

        // Obtain an evaluator for the reference point observed in the central body's fixed frame.
        // Notice that we create this evaluator in the same EvaluatorGroup.
        var pointEvaluator = GeometryTransformer.ObservePoint(ReferencePoint, CentralBody.FixedFrame, group);

        return new Evaluator(group, pointEvaluator, CentralBody.Shape);
    }

    private CentralBody m_centralBody;
    private Point m_referencePoint;

    // This is the definition of the Evaluator that is used to actually evaluate this Point.
    // Because it is a private, nested class, it is not visible outside of the SurfacePosition
    // class. This is ok, though, because once it is created users only interact with it via a
    // reference to its base class: PointEvaluator.
    private sealed class Evaluator : PointEvaluator
    {
        // An evaluator should not store any data that the user will be able to change
        // after creating the evaluator.  This sometimes requires that data required by the
        // evaluator be copied or frozen using the IFreezable interface.
        public Evaluator(EvaluatorGroup group, PointEvaluator pointEvaluator, Ellipsoid shape)
            : base(group)
        {
            m_pointEvaluator = pointEvaluator;
            m_shape = shape;
        }

        // The Evaluator's copy constructor will be called from the Clone method.
        // Don't forget to call the base class implementation!
        private Evaluator(Evaluator existingInstance, CopyContext context)
            : base(existingInstance, context)
        {
            // Use the UpdateReference method on the CopyContext to perform any updates to the
            // reference that are required by the context.
            m_shape = context.UpdateReference(existingInstance.m_shape);

            // For evaluators, just assign the reference directly - we'll call UpdateReference later.
            m_pointEvaluator = existingInstance.m_pointEvaluator;

            // Always call UpdateEvaluatorReferences at the end of the copy constructor.
            // This is where references to evaluators will be updated.
            UpdateEvaluatorReferences(context);
        }

        // This method is used by the EvaluatorGroup system to avoid redundant evaluations. The
        // EvaluatorGroup may call it on your evaluator in order to replace your evaluator's
        // reference to another evaluator with a reference to a version that caches its last
        // result.
        public override void UpdateEvaluatorReferences(CopyContext context)
        {
            m_pointEvaluator = context.UpdateReference(m_pointEvaluator);
        }

        // The Clone method should call the copy constructor.
        public override object Clone(CopyContext context)
        {
            return new Evaluator(this, context);
        }

        // This method determines if there is data available from this Evaluator at
        // the specified date.
        public override bool IsAvailable(JulianDate date)
        {
            // This evaluator is available whenever the nested evaluator is available.
            return m_pointEvaluator.IsAvailable(date);
        }

        // This method returns a collection of time intervals when data is
        // available from this Evaluator.
        public override TimeIntervalCollection GetAvailabilityIntervals(TimeIntervalCollection consideredIntervals)
        {
            // This evaluator is available whenever the nested evaluator is available.
            return m_pointEvaluator.GetAvailabilityIntervals(consideredIntervals);
        }

        // This property determines if this Evaluator can safely be used from multiple threads
        // simultaneously. If the evaluator stores data during the Evaluate call, it is not thread
        // safe. Otherwise, it generally is thread safe as long as any nested evaluators it uses
        // are thread safe.
        public override bool IsThreadSafe
        {
            get
            {
                // This evaluator is thread safe as long as the nested evaluator is thread safe.
                return m_pointEvaluator.IsThreadSafe;
            }
        }

        // This property determines if this Evaluator result changes depending on the time at which it is evaluated.
        public override bool IsTimeVarying
        {
            get { return m_pointEvaluator.IsTimeVarying; }
        }

        // This property expresses the ReferenceFrame(s) that this Point is defined in
        // for various intervals.
        public override TimeIntervalCollection<ReferenceFrame> DefinedInIntervals
        {
            get
            {
                // This point is defined in the same reference frame(s) that the nested evaluator is defined in.
                return m_pointEvaluator.DefinedInIntervals;
            }
        }

        // This is where we do the actual evaluation when only the position of the point (not its velocity,
        // acceleration, etc.) is required.
        public override Cartesian Evaluate(JulianDate date)
        {
            Cartesian position = m_pointEvaluator.Evaluate(date);
            Cartesian surfacePosition = m_shape.SurfaceProjection(position);
            return surfacePosition;
        }

        // This is where we do the actual evaluation when the velocity and acceleration of the point
        // are requested as well.
        public override Motion<Cartesian> Evaluate(JulianDate date, int order)
        {
            Motion<Cartesian> motion = m_pointEvaluator.Evaluate(date, order);
            Motion<Cartesian> surfaceMotion = m_shape.SurfaceProjection(motion, order);
            return surfaceMotion;
        }

        // Override the Dispose method to call the Dispose() method on any nested
        // evaluators or other disposable nested types.
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                m_pointEvaluator.Dispose();
            }
        }

        private readonly Ellipsoid m_shape;
        private PointEvaluator m_pointEvaluator;
    }
}
See Also
Inheritance Hierarchy
SystemObject
  AGI.Foundation.InfrastructureDefinitionalObject
    AGI.Foundation.GeometryPoint
      AGI.Foundation.AircraftPropagationAircraftMotionIntegrationPoint
      AGI.Foundation.GeometryCompositePoint
      AGI.Foundation.GeometryEntityPointTEntity
      AGI.Foundation.GeometryJplDECenterOfMassPoint
      AGI.Foundation.GeometryParameterizedOnEvaluatorPoint
      AGI.Foundation.GeometryParameterizedOnStatePoint
      AGI.Foundation.GeometryParameterizedPoint
      AGI.Foundation.GeometryPointAtAltitude
      AGI.Foundation.GeometryPointCartographic
      AGI.Foundation.GeometryPointCentralBodyProjection
      AGI.Foundation.GeometryPointDifferentiator
      AGI.Foundation.GeometryPointFixedAtJulianDate
      AGI.Foundation.GeometryPointFixedOffset
      AGI.Foundation.GeometryPointFromArchiveTEntity
      AGI.Foundation.GeometryPointInPointsFrame
      AGI.Foundation.GeometryPointInReferenceFrame
      AGI.Foundation.GeometryPointInRegionNearestToReferencePoint
      AGI.Foundation.GeometryPointInterpolator
      AGI.Foundation.GeometryPointPropagationParameter
      AGI.Foundation.GeometryPointVectorToPoint
      AGI.Foundation.GeometryServiceProviderPoint
      AGI.Foundation.PlatformsPlatformLocationPoint
      AGI.Foundation.PropagatorsPropagatorPoint