public void PitchAboutCenter(double pitch, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Pitch(_vertices[i], pitch, Center, vRoll);
     }
     _trajectory = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
     _roll = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
     BuildEdges();
 }
 public void PitchAboutPoint(double pitch, Point point)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Pitch(_vertices[i], pitch, point, vRoll);
     }
     _trajectory = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
     _roll = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
     BuildEdges();
 }
 /// <summary>
 /// Projects the vector in the direction of the vector provided.
 /// </summary>
 /// <param name="vector">Vector to project onto.</param>
 /// <returns>Projected Vector.</returns>
 public Vector ProjectOnto(Vector vector)
 {
     return ((this.Dot(vector))/vector.r) * vector.Unit;
 }
 /// <summary>
 /// Offsets the polygon by the given movement (vector)
 /// </summary>
 /// <param name="movement">Movement (vector)</param>
 public void Offset(Vector movement)
 {
     for(int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = (_vertices[i] + movement).ToPoint();
     }
     _trajectory = (_trajectory + movement).ToPoint();
     _roll = (_trajectory + movement).ToPoint();
 }
 public void YawAboutCenter(double yaw, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Yaw(_vertices[i], yaw, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Yaw(_trajectory, yaw, Center, trajectory, vRoll);
     _roll = Rotation.Yaw(_trajectory, yaw, Center, trajectory, vRoll);
     BuildEdges();
 }
 public void PitchAboutCenter(double pitch, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].PitchAboutPoint(pitch, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
     _roll = Rotation.Pitch(_trajectory, pitch, Center, vRoll);
 }
 public void YawAboutCenter(double yaw)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].YawAboutPoint(yaw, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Yaw(_trajectory, yaw, Center, trajectory, vRoll);
     _roll = Rotation.Yaw(_trajectory, yaw, Center, trajectory, vRoll);
 }
 /// <summary>
 /// Rotates the polygon about its center in its frame of reference.
 /// </summary>
 /// <param name="yaw">Angle to yaw (radians).</param>
 /// <param name="pitch">Angle to pitch (radians).</param>
 /// <param name="roll">Angle to roll (radians).</param>
 public void RotateAboutCenter(double yaw, double pitch, double roll)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Rotate(_vertices[i], yaw, pitch, roll, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Rotate(_trajectory, yaw, pitch, roll, Center, trajectory, vRoll);
     _roll = Rotation.Rotate(_trajectory, yaw, pitch, roll, Center, trajectory, vRoll);
     BuildEdges();
 }
 public void RotateAboutCenter(double yaw, double pitch, double roll, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].RotateAboutPoint(yaw, pitch, roll, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Rotate(_trajectory, yaw, pitch, roll, Center, trajectory, vRoll);
     _roll = Rotation.Rotate(_trajectory, yaw, pitch, roll, Center, trajectory, vRoll);
 }
 public void RotateAboutPoint(double yaw, double pitch, double roll, Point point)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].RotateAboutPoint(yaw, pitch, roll, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Rotate(_trajectory, yaw, pitch, roll, point, trajectory, vRoll);
     _roll = Rotation.Rotate(_trajectory, yaw, pitch, roll, point, trajectory, vRoll);
 }
 public void RollAboutPoint(double roll, Point point, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].RollAboutPoint(roll, point, trajectory, vRoll);
     }
     _trajectory = Rotation.Roll(_trajectory, roll, point, trajectory);
     _roll = Rotation.Roll(_trajectory, roll, point, trajectory);
 }
 public void RollAboutCenter(double roll)
 {
     Vector trajectory = new Vector(_trajectory);
     Vector vRoll = new Vector(_roll);
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].RollAboutPoint(roll, Center, trajectory, vRoll);
     }
     _trajectory = Rotation.Roll(_trajectory, roll, Center, trajectory);
     _roll = Rotation.Roll(_trajectory, roll, Center, trajectory);
 }
 public void PitchAboutPoint(double pitch, Point point)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].PitchAboutPoint(pitch, point, trajectory, vRoll);
     }
     _trajectory = Rotation.Pitch(_trajectory, pitch, point, vRoll);
     _roll = Rotation.Pitch(_trajectory, pitch, point, vRoll);
 }
 public void RollAboutPoint(double roll, Point point, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Roll(_vertices[i], roll, point, trajectory);
     }
     _trajectory = Rotation.Roll(_trajectory, roll, point, trajectory);
     _roll = Rotation.Roll(_trajectory, roll, point, trajectory);
     BuildEdges();
 }
 public void YawAboutPoint(double yaw, Point point, Vector trajectory, Vector vRoll)
 {
     for (int i = 0; i < _faces.Count; ++i)
     {
         _faces[i].YawAboutPoint(yaw, point, trajectory, vRoll);
     }
     _trajectory = Rotation.Yaw(_trajectory, yaw, point, trajectory, vRoll);
     _roll = Rotation.Yaw(_trajectory, yaw, point, trajectory, vRoll);
 }
 public void RollAboutPoint(double roll, Point point)
 {
     Vector trajectory = new Vector(1, 0, 0);
     Vector vRoll = new Vector(0, 1, 0);
     for (int i = 0; i < _vertices.Count; i++)
     {
         _vertices[i] = Rotation.Roll(_vertices[i], roll, point, trajectory);
     }
     _trajectory = Rotation.Roll(_trajectory, roll, point, trajectory);
     _roll = Rotation.Roll(_trajectory, roll, point, trajectory);
     BuildEdges();
 }
Beispiel #17
0
        /// <summary>
        /// Calculates the Cross Product against the provided vector
        /// </summary>
        /// <param name="vector">Vector to cross.</param>
        /// <returns>Cross "Vector" product</returns>
        public Vector Cross(Vector vector)
        {
            Vector result = new Vector(1, -1, 1);

            result.i = result.i * ((j * vector.k) - (k * vector.j));
            result.j = result.j * ((i * vector.k) - (k * vector.i));
            result.k = result.k * ((i * vector.j) - (j * vector.i));

            return result;
        }
 /// <summary>
 /// Rotates the polygon about the given point in the given frame of reference
 /// </summary>
 /// <param name="yaw">Angle to yaw (radians).</param>
 /// <param name="pitch">Angle to pitch (radians).</param>
 /// <param name="roll">Angle to roll (radians).</param>
 /// <param name="point">Point to rotate about.</param>
 /// <param name="trajectory">Direction facing (vector).</param>
 /// <param name="vroll">Direction of Roll (vector).</param>
 public void RotateAboutPoint(double yaw, double pitch, double roll, Point point, Vector trajectory, Vector vRoll)
 {
     for(int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Rotate(_vertices[i], yaw, pitch, roll, point, trajectory, vRoll);
     }
     _trajectory = Rotation.Rotate(_trajectory, yaw, pitch, roll, point, trajectory, vRoll);
     _roll = Rotation.Rotate(_trajectory, yaw, pitch, roll, point, trajectory, vRoll);
     BuildEdges();
 }
Beispiel #19
0
 /// <summary>
 /// Calculates the Dot Product against the provided vector.
 /// </summary>
 /// <param name="vector">Vector to dot against.</param>
 /// <returns>Dot "Scalar" product.</returns>
 public double Dot(Vector vector)
 {
     return i * vector.i + j * vector.j + k * vector.k;
 }
 public void YawAboutPoint(double yaw, Point point)
 {
     Vector trajectory = new Vector(Center, _trajectory);
     Vector vRoll = new Vector(Center, _roll);
     for (int i = 0; i < _vertices.Count; ++i)
     {
         _vertices[i] = Rotation.Yaw(_vertices[i], yaw, point, trajectory, vRoll);
     }
     _trajectory = Rotation.Yaw(_trajectory, yaw, point, trajectory, vRoll);
     _roll = Rotation.Yaw(_trajectory, yaw, point, trajectory, vRoll);
     BuildEdges();
 }
 /// <summary>
 /// Offsets the polyhedron by the given movement (vector)
 /// </summary>
 /// <param name="movement">Movement (vector)</param>
 public void Offset(Vector movement)
 {
     foreach(Polygon face in _faces)
     {
         face.Offset(movement);
     }
 }