Example #1
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 13JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Subdivides the quadratic curve specified by the <code>src</code>
  * parameter and stores the resulting two subdivided curves into the
  * <code>left</code> and <code>right</code> curve parameters.
  * Either or both of the <code>left</code> and <code>right</code>
  * objects can be the same as the <code>src</code> object or
  * <code>null</code>.
  * @param src the quadratic curve to be subdivided
  * @param left the <code>QuadCurve</code> object for storing the
  *		left or first half of the subdivided curve
  * @param right the <code>QuadCurve</code> object for storing the
  *		right or second half of the subdivided curve
  */
 public static void Subdivide(QuadCurve src,
         QuadCurve left,
         QuadCurve right)
 {
     double x1 = src.GetX1();
     double y1 = src.GetY1();
     double ctrlx = src.GetCtrlX();
     double ctrly = src.GetCtrlY();
     double x2 = src.GetX2();
     double y2 = src.GetY2();
     double ctrlx1 = (x1 + ctrlx) / 2.0;
     double ctrly1 = (y1 + ctrly) / 2.0;
     double ctrlx2 = (x2 + ctrlx) / 2.0;
     double ctrly2 = (y2 + ctrly) / 2.0;
     ctrlx = (ctrlx1 + ctrlx2) / 2.0;
     ctrly = (ctrly1 + ctrly2) / 2.0;
     if (left != null)
     {
         left.SetCurve(x1, y1, ctrlx1, ctrly1, ctrlx, ctrly);
     }
     if (right != null)
     {
         right.SetCurve(ctrlx, ctrly, ctrlx2, ctrly2, x2, y2);
     }
 }
Example #2
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 13JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Sets the location of the end points and control point of this
  * <code>QuadCurve</code> to the same as those in the specified
  * <code>QuadCurve</code>.
  * @param c the specified <code>QuadCurve</code>
  */
 public void SetCurve(QuadCurve c)
 {
     SetCurve(c.GetX1(), c.GetY1(),
             c.GetCtrlX(), c.GetCtrlY(),
             c.GetX2(), c.GetY2());
 }