Beispiel #1
0
 private double doubleVectorAbs(Vector<Vector<Double>> doubleVector) {
   double totalX = 0;
   for (Vector<Double> vector : doubleVector) {
     totalX += Math.pow(vectorAbs(vector), 2);
   }
   return Math.sqrt(totalX);
 }
    private static Point2D evalParametric(CubicCurve2D curve, double t) {
      if (null == curve) {
        return null;
      }

      // B(t) = (1-t)^3 P_0 + 3(1-t)^2t C_1 + 3(1 - t)t^2 C_2 + t^3 P_1
      // do nothing fancy, just calculate it.
      double rx =
          ((Math.pow((1 - t), 3) * curve.getX1()))
              + (3 * Math.pow((1 - t), 2) * t * curve.getCtrlX1())
              + (3 * (1 - t) * t * t * curve.getCtrlX2())
              + (t * t * t * curve.getX2());
      double ry =
          ((Math.pow((1 - t), 3) * curve.getY1()))
              + (3 * Math.pow((1 - t), 2) * t * curve.getCtrlY1())
              + (3 * (1 - t) * t * t * curve.getCtrlY2())
              + (t * t * t * curve.getY2());

      return new Point2D.Float((float) rx, (float) ry);
    }
Beispiel #3
0
 private double vectorAbs(Vector<Double> vector) {
   double totalX = 0;
   for (Double x : vector) totalX += Math.pow(x, 2);
   return Math.sqrt(totalX);
 }