Esempio n. 1
0
        /// <summary>
        /// Compute the dot product between the current and given vector
        /// </summary>
        public double dot(Vector2d v)
        {
            Coord2d v1 = this.vector();
            Coord2d v2 = v.vector();

            return(v1.x * v2.x + v1.y * v2.y);
        }
Esempio n. 2
0
        /// <summary>
        /// Return a copy of the current bounding box after scaling all limits relative to 0,0
        /// Scaling does not modify the current bounding box.
        /// </summary>
        /// <remarks>Current object is not modified, a new one is created.</remarks>
        public BoundingBox2d scale(Coord2d factors)
        {
            BoundingBox2d b = new BoundingBox2d();

            b.m_xmax = m_xmax * factors.x;
            b.m_xmin = m_xmin * factors.x;
            b.m_ymax = m_ymax * factors.y;
            b.m_ymin = m_ymin * factors.y;
            return(b);
        }
Esempio n. 3
0
 public Vector2d(Coord2d p1, Coord2d p2) : this(p1.x, p2.x, p1.y, p2.y)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Add values of another <see cref="Coord2d"/> to all components of the current <see cref="Coord2d"/> and return the result
 /// in a new <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to add</param>
 /// <remarks>Current object is not modified</remarks>
 public Coord2d @add(Coord2d coord)
 {
     return(new Coord2d(this.x + coord.x, this.y + coord.y));
 }
Esempio n. 5
0
 /// <summary>
 /// Compute the distance between two coordinates.
 /// </summary>
 /// <returns></returns>
 /// <remarks></remarks>
 public double distance(Coord2d coord)
 {
     return(Math.Sqrt(Math.Pow((this.x - coord.x), 2) + Math.Pow((this.y - coord.y), 2)));
 }
Esempio n. 6
0
 /// <summary>
 /// Divide components of the current <see cref="Coord2d"/> by values of another <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to divide by</param>
 public void divideSelf(Coord2d coord)
 {
     this.x /= coord.x;
     this.y /= coord.y;
 }
Esempio n. 7
0
 /// <summary>
 /// Divide components of the current <see cref="Coord2d"/> by components of another <see cref="Coord2d"/> and return the result
 /// in a new <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to divide with</param>
 /// <remarks>Current object is not modified</remarks>
 public Coord2d divide(Coord2d coord)
 {
     return(new Coord2d(this.x / coord.x, this.y / coord.y));
 }
Esempio n. 8
0
 /// <summary>
 /// Multiply components of the current <see cref="Coord2d"/> with values of another <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to multiply with</param>
 public void multiplySelf(Coord2d coord)
 {
     this.x *= coord.x;
     this.y *= coord.y;
 }
Esempio n. 9
0
 /// <summary>
 /// Multiply components of another <see cref="Coord2d"/> with components of the current <see cref="Coord2d"/> and return the result
 /// in a new <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to multiply with</param>
 /// <remarks>Current object is not modified</remarks>
 public Coord2d multiply(Coord2d coord)
 {
     return(new Coord2d(this.x * coord.x, this.y * coord.y));
 }
Esempio n. 10
0
 /// <summary>
 /// Substract values of another <see cref="Coord2d"/> to all components of the current <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to substract</param>
 public void substractSelf(Coord2d coord)
 {
     this.x -= coord.x;
     this.y -= coord.y;
 }
Esempio n. 11
0
 /// <summary>
 /// Substract values of another <see cref="Coord2d"/> to all components of the current <see cref="Coord2d"/> and return the result
 /// in a new <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to substract</param>
 /// <remarks>Current object is not modified</remarks>
 public Coord2d substract(Coord2d coord)
 {
     return(new Coord2d(this.x - coord.x, this.y - coord.y));
 }
Esempio n. 12
0
 /// <summary>
 /// Add values of another <see cref="Coord2d"/> to all components of the current <see cref="Coord2d"/>.
 /// </summary>
 /// <param name="coord">Coordinate with values to add</param>
 public void addSelf(Coord2d coord)
 {
     this.x += coord.x;
     this.y += coord.y;
 }
Esempio n. 13
0
 public Angle2d(Coord2d p1, Coord2d p2, Coord2d p3) : this(p1.x, p2.x, p3.x, p1.y, p2.y, p3.y)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// Adds a <see cref="Coord2d"/> point to the bounding box, and enlarge the bounding
 /// box if this points lies outside of it.
 /// </summary>
 public void @add(Coord2d p)
 {
     this.@add(p.x, p.y);
 }
Esempio n. 15
0
 /// <summary>
 /// Return true if <paramref name="aPoint"/> is contained in this box.
 /// </summary>
 public bool contains(Coord2d aPoint)
 {
     return(m_xmin <= aPoint.x & aPoint.x <= m_xmax & m_ymin <= aPoint.y & aPoint.y <= m_ymax);
 }