public void LineSegment_Translate_ShouldTranslateAsVector()
        {
            LineSegment lineSegment = new LineSegment(Point.MakePointWithInches(1, 1, 1));
            Translation translation = new Translation(new Vector(Point.MakePointWithInches(0, 1, 0)));

            lineSegment.Translate(translation).Should().Be(new LineSegment(Point.MakePointWithInches(0, 1, 0), Point.MakePointWithInches(1, 2, 1)));
        }
 /// <summary>
 /// Creates a copy of the given translation
 /// </summary>
 /// <param name="toCopy">The translation to copy</param>
 public Translation(Translation toCopy)
 {
     this.Point = toCopy.Point;
 }
Esempio n. 3
0
  /// <summary>
  /// Translates the arc with the given translation
  /// </summary>
  /// <param name="translation">The translation to apply to the Arc</param>
  /// <returns>A new Arc object that has been translated</returns>
  public Arc Translate(Translation translation)
  {
      Point newBasePoint = BasePoint.Translate(translation);
      Point newEndPoint = EndPoint.Translate(translation);
      Point newCenterPoint = CenterPoint.Translate(translation);
 
      return new Arc(newBasePoint, newEndPoint, newCenterPoint, this.NormalDirection);
  }
Esempio n. 4
0
 /// <summary>
 /// Creates a Shift with multiple Rotations and a displacment, or zero translation if it is omitted
 /// </summary>
 /// <param name="rotations">The rotations that make up and are represented by this shift</param>
 /// <param name="displacement">The distance of displacement this shift represents in each direction</param>
 public Shift(List<Rotation> rotations, Point displacement = null)
 {
     if (displacement == null)
     {
         displacement = Point.Origin;
     }
    
     foreach(var rotation in rotations)
     {
         _matrix = rotation.Matrix * _matrix;
     }
     var translationMatrix = new Translation(displacement).Matrix;
     _matrix = translationMatrix * _matrix;
 }
        private void _setMatrix()
        {
            var translateInverse = new Translation(_axisOfRotation.BasePoint.Negate()).Matrix;
            var rotate = _matrixOfRotationAboutOrigin();
            var translate = new Translation(_axisOfRotation.BasePoint).Matrix;

            this._matrix = translate * (rotate * translateInverse);
        }