Quadratic Bezier line to the given relative coordinates.

@param c1x first control point x
@param c1y first control point y
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax.
428296
public SVGPath relativeQuadTo(double c1x, double c1y, double x, double y) {
    return append(PATH_QUAD_TO_RELATIVE).append(c1x).append(c1y).append(x).append(y);
  }
1079575
public static final Direction getQuadrant(final double cx, final double cy, final double x0, final double y0)
    {
        if ((x0 > cx) && (y0 < cy))
        {
            return Direction.NORTH_EAST;
        }
        if ((x0 > cx) && (y0 >= cy))
        {
            return Direction.SOUTH_EAST;
        }
        if ((x0 <= cx) && (y0 >= cy))
        {
            return Direction.SOUTH_WEST;
        }
        // if( x0 <= c.getX() && y0 < c.getY() )
        return Direction.NORTH_WEST;
    }
1019913
@ExportConstructor
	public static org.geomajas.geometry.Coordinate constructor(double x, double y) {
		return new org.geomajas.geometry.Coordinate(x, y);
	}
1335567
function (elem, fromD, toD) {
		fromD = fromD || '';
		var shift = elem.shift,
			bezier = fromD.indexOf('C') > -1,
			numParams = bezier ? 7 : 3,
			endLength,
			slice,
			i,
			start = fromD.split(' '),
			end = [].concat(toD), // copy
			startBaseLine,
			endBaseLine,
			sixify = function (arr) { // in splines make move points have six parameters like bezier curves
				i = arr.length;
				while (i--) {
					if (arr[i] === M) {
						arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]);
					}
				}
			};

		if (bezier) {
			sixify(start);
			sixify(end);
		}

		// pull out the base lines before padding
		if (elem.isArea) {
			startBaseLine = start.splice(start.length - 6, 6);
			endBaseLine = end.splice(end.length - 6, 6);
		}

		// if shifting points, prepend a dummy point to the end path
		if (shift <= end.length / numParams && start.length === end.length) {
			while (shift--) {
				end = [].concat(end).splice(0, numParams).concat(end);
			}
		}
		elem.shift = 0; // reset for following animations

		// copy and append last point until the length matches the end length
		if (start.length) {
			endLength = end.length;
			while (start.length < endLength) {

				//bezier && sixify(start);
				slice = [].concat(start).splice(start.length - numParams, numParams);
				if (bezier) { // disable first control point
					slice[numParams - 6] = slice[numParams - 2];
					slice[numParams - 5] = slice[numParams - 1];
				}
				start = start.concat(slice);
			}
		}

		if (startBaseLine) { // append the base lines for areas
			start = start.concat(startBaseLine);
			end = end.concat(endBaseLine);
		}
		return [start, end];
	}
515645
public Coordinate nearest(Coordinate c) {
		double len = this.getLength();

		double u = (c.getX() - this.c1.getX()) * (this.c2.getX() - this.c1.getX()) + (c.getY() - this.c1.getY())
				* (this.c2.getY() - this.c1.getY());
		u = u / (len * len);

		if (u < 0.00001 || u > 1) {
			// Shortest point not within LineSegment, so take closest end-point.
			LineSegment ls1 = new LineSegment(c, this.c1);
			LineSegment ls2 = new LineSegment(c, this.c2);
			double len1 = ls1.getLength();
			double len2 = ls2.getLength();
			if (len1 < len2) {
				return this.c1;
			}
			return this.c2;
		} else {
			// Intersecting point is on the line, use the formula: P = P1 + u (P2 - P1)
			double x1 = this.c1.getX() + u * (this.c2.getX() - this.c1.getX());
			double y1 = this.c1.getY() + u * (this.c2.getY() - this.c1.getY());
			return new Coordinate(x1, y1);
		}
	}
294778
function curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3) {
    // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points
    // as the control points for the curve.
    $this->objects[$this->currentContents]['c'] .=
      sprintf("\n%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c S", $x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3);
  }
918854
def get_4pt_bezier(steps, points):
    """"""
    for i in range(steps):
        t = i / float(steps)

        xloc = (math.pow(1 - t, 3) * points[0][0] +
                3 * t * math.pow(1 - t, 2) * points[1][0] +
                3 * (1 - t) * math.pow(t, 2) * points[2][0] +
                math.pow(t, 3) * points[3][0])
        yloc = (math.pow(1 - t, 3) * points[0][1] +
                3 * t * math.pow(1 - t, 2) * points[1][1] +
                3 * (1 - t) * math.pow(t, 2) * points[2][1] +
                math.pow(t, 3) * points[3][1])

        yield (xloc, yloc)
907003
public SVGPath cubicTo(double[] c1xy, double[] c2xy, double[] xy) {
    return append(PATH_CUBIC_TO).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]);
  }
821547
public SVGPath relativeCubicTo(double[] c1xy, double[] c2xy, double[] xy) {
    return append(PATH_CUBIC_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]);
  }
155776
def qcurve(self, vertexes, attr=0, row=None):
        ''
        assert len(vertexes) == 3, len(vertexes)
        x1, y1 = vertexes[0]
        x2, y2 = vertexes[1]
        x3, y3 = vertexes[2]

        self.point(x1, y1, attr, row)
        self._recursive_bezier(x1, y1, x2, y2, x3, y3, attr, row)
        self.point(x3, y3, attr, row)
883357
function bezierat (a, b, c, d, t) {
   return Math.pow(1-t, 3) * a +
        3 * t * Math.pow(1-t, 2) * b +
        3 * Math.pow(t, 2) * (1 - t) * c +
        Math.pow(t, 3) * d
}
168978
public void closePathWithBezier(Point2D controlPoint1, Point2D controlPoint2) {
		_touch();
		if (isEmptyImpl())
			throw new GeometryException(
					"Invalid call. This operation cannot be performed on an empty geometry.");

		m_bPathStarted = false;

		int pathIndex = m_paths.size() - 2;
		byte pf = m_pathFlags.read(pathIndex);
		m_pathFlags
				.write(pathIndex,
						(byte) (pf | PathFlags.enumClosed | PathFlags.enumHasNonlinearSegments));
		_initSegmentData(6);

		byte oldType = m_segmentFlags
				.read((byte) ((m_pointCount - 1) & SegmentFlags.enumSegmentMask));
		m_segmentFlags.write(m_pointCount - 1,
				(byte) (SegmentFlags.enumBezierSeg));

		int curveIndex = m_curveParamwritePoint;
		if (getSegmentDataSize(oldType) < getSegmentDataSize((byte) SegmentFlags.enumBezierSeg)) {
			m_segmentParamIndex.write(m_pointCount - 1, m_curveParamwritePoint);
			m_curveParamwritePoint += 6;
		} else {
			// there was a closing bezier curve or an arc here. We can reuse the
			// storage.
			curveIndex = m_segmentParamIndex.read(m_pointCount - 1);
		}

		double z;
		m_segmentParams.write(curveIndex, controlPoint1.x);
		m_segmentParams.write(curveIndex + 1, controlPoint1.y);
		z = 0;// TODO: calculate me.
		m_segmentParams.write(curveIndex + 2, z);

		m_segmentParams.write(curveIndex + 3, controlPoint2.x);
		m_segmentParams.write(curveIndex + 4, controlPoint2.y);
		z = 0;// TODO: calculate me.
		m_segmentParams.write(curveIndex + 5, z);
	}
68797
public Quaternion fromAnglesXY (float x, float y) {
        float hx = x * 0.5f, hy = y * 0.5f;
        float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx);
        float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy);
        return set(cy*sx, sy*cx, -sy*sx, cy*cx);
    }
142740
public static double[] getPlaneCoefficientsFrom3Points( Coordinate c1, Coordinate c2, Coordinate c3 ) {
        double a = (c2.y - c1.y) * (c3.z - c1.z) - (c3.y - c1.y) * (c2.z - c1.z);
        double b = (c2.z - c1.z) * (c3.x - c1.x) - (c3.z - c1.z) * (c2.x - c1.x);
        double c = (c2.x - c1.x) * (c3.y - c1.y) - (c3.x - c1.x) * (c2.y - c1.y);
        double d = -1.0 * (a * c1.x + b * c1.y + c * c1.z);
        return new double[]{a, b, c, d};
    }
997861
def _svg_path_convert(paths):
    
    def complex_to_float(values):
        return np.array([[i.real, i.imag] for i in values])

    def load_line(svg_line):
        points = complex_to_float([svg_line.point(0.0),
                                   svg_line.point(1.0)])
        if starting:
            # return every vertex and use it
            return (entities_mod.Line(np.arange(2) + len(vertices)), points)
        else:
            # we are not starting so use the last referenced vertex as the
            # start point
            return (entities_mod.Line(
                np.arange(2) + len(vertices) - 1), points[1:])

    def load_arc(svg_arc):
        points = complex_to_float([svg_arc.start,
                                   svg_arc.point(.5),
                                   svg_arc.end])
        if starting:
            # return every vertex and use it
            return (entities_mod.Arc(np.arange(3) + len(vertices)), points)
        else:
            # we are not starting so use the last referenced vertex as the
            # start point
            return (entities_mod.Arc(np.arange(3) +
                                     len(vertices) - 1), points[1:])

    def load_quadratic(svg_quadratic):
        points = complex_to_float([svg_quadratic.start,
                                   svg_quadratic.control,
                                   svg_quadratic.end])
        if starting:
            # return every vertex and use it
            return (entities_mod.Bezier(np.arange(3) + len(vertices)), points)
        else:
            # we are not starting so use the last referenced vertex as the
            # start point
            return (entities_mod.Bezier(
                np.arange(3) + len(vertices) - 1), points[1:])

    def load_cubic(svg_cubic):
        points = complex_to_float([svg_cubic.start,
                                   svg_cubic.control1,
                                   svg_cubic.control2,
                                   svg_cubic.end])
        if starting:
            # return every vertex and use it
            return (entities_mod.Bezier(np.arange(4) + len(vertices)), points)
        else:
            # we are not starting so use the last referenced vertex as the
            # start point
            return (entities_mod.Bezier(
                np.arange(4) + len(vertices) - 1), points[1:])

    # store loaded values here
    entities = []
    vertices = []
    loaders = {'Arc': load_arc,
               'Line': load_line,
               'CubicBezier': load_cubic,
               'QuadraticBezier': load_quadratic}

    for path_string, matrix in paths:
        starting = True
        for svg_entity in parse_path(path_string):
            type_name = svg_entity.__class__.__name__
            if type_name in loaders:
                e, v = loaders[type_name](svg_entity)
                entities.append(e)
                vertices.extend(transform_points(v, matrix))
    # store results as kwargs
    loaded = {'entities': np.array(entities),
              'vertices': np.array(vertices)}
    return loaded
1354800
public static BezierCurve getInstance(int degree)
    {
        if (degree < 1)
        {
            throw new IllegalArgumentException("illegal degree");
        }
        switch (degree)
        {
            case 1:
                return LINE;
            case 2:
                return QUAD;
            case 3:
                return CUBIC;
            default:
                return new BezierCurve(degree);
        }
    }
509697
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy)
{
    var v0x = cx-ax;
    var v0y = cy-ay;
    var v1x = bx-ax;
    var v1y = by-ay;
    var v2x = px-ax;
    var v2y = py-ay;

    var dot00 = v0x*v0x+v0y*v0y;
    var dot01 = v0x*v1x+v0y*v1y;
    var dot02 = v0x*v2x+v0y*v2y;
    var dot11 = v1x*v1x+v1y*v1y;
    var dot12 = v1x*v2x+v1y*v2y;

    var invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
    var u = (dot11 * dot02 - dot01 * dot12) * invDenom;
    var v = (dot00 * dot12 - dot01 * dot02) * invDenom;

    // Check if point is in triangle
    return (u >= 0) && (v >= 0) && (u + v < 1);
}