/// <summary>
 /// Gets the tangent plane at the specified position
 /// </summary>
 public Plane3 GetTangentPlaneUnderPoint( UniPoint3 pos, out Point3 pointOnPlane )
 {
     Vector3 normal = Planet.Transform.Position.VectorTo( pos ).MakeNormal( );
     Vector3 vec = normal * ( Planet.Model.Radius + m_GeometryRadius ).ToRenderUnits;
     pointOnPlane = vec.ToPoint3( );
     return new Plane3( pointOnPlane, normal );
 }
 /// <summary>
 /// Sets the coordinate frame
 /// </summary>
 public void Set( UniPoint3 pt, Vector3 xAxis, Vector3 yAxis, Vector3 zAxis )
 {
     Position = pt;
     m_Axis[ 0 ] = xAxis;
     m_Axis[ 1 ] = yAxis;
     m_Axis[ 2 ] = zAxis;
 }
예제 #3
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 public UniPoint3( UniPoint3 src )
 {
     m_X = src.m_X;
     m_Y = src.m_Y;
     m_Z = src.m_Z;
 }
예제 #4
0
        public Vector3 VectorTo( UniPoint3 pt )
        {
            double vecX = ( pt.m_X - m_X );
            double vecY = ( pt.m_Y - m_Y );
            double vecZ = ( pt.m_Z - m_Z );

            double invLength = 1.0 / Math.Sqrt( vecX * vecX + vecY * vecY + vecZ * vecZ );
            return new Vector3( ( float )( vecX * invLength ), ( float )( vecY * invLength ), ( float )( vecZ * invLength ) );
        }
예제 #5
0
        public long SqrDistanceTo( UniPoint3 pt )
        {
            long diffX = ( m_X - pt.m_X );
            long diffY = ( m_Y - pt.m_Y );
            long diffZ = ( m_Z - pt.m_Z );

            return ( diffX * diffX + diffY * diffY + diffZ * diffZ );
        }
예제 #6
0
        public long ManhattanDistanceTo( UniPoint3 pt )
        {
            long diffX = ( m_X - pt.m_X );
            long diffY = ( m_Y - pt.m_Y );
            long diffZ = ( m_Z - pt.m_Z );

            return ( diffX < 0 ? -diffX : diffX ) + ( diffY < 0 ? -diffY : diffY ) + ( diffZ < 0 ? -diffZ : diffZ );
        }
예제 #7
0
 public double DistanceTo( UniPoint3 pt )
 {
     return Math.Sqrt( SqrDistanceTo( pt ) );
 }
예제 #8
0
 /// <summary>
 /// Copies another vector
 /// </summary>
 public void Copy( UniPoint3 src )
 {
     m_X = src.m_X;
     m_Y = src.m_Y;
     m_Z = src.m_Z;
 }
 /// <summary>
 /// Gets the tangent space matrix at the specified position
 /// </summary>
 public Matrix44 GetTangentSpaceUnderPoint( UniPoint3 pos )
 {
     throw new NotImplementedException( );
 }
예제 #10
0
 /// <summary>
 /// Setup constructor
 /// </summary>
 public UniRay3( UniPoint3 origin, Vector3 dir )
 {
     m_Origin = origin;
     m_Direction = dir;
 }
예제 #11
0
 /// <summary>
 /// Default constructor. Places the ray at the origin, pointing along the z axis
 /// </summary>
 public UniRay3( )
 {
     m_Origin = new UniPoint3( );
     m_Direction = Vector3.ZAxis;
 }