Esempio n. 1
0
 @Override
 protected Point[] generatePoints(Point center, int number) {
   Vector3f offset = Point.FORWARD.mul(radius);
   int angle = number == 0 ? 0 : (360 / number);
   Matrix3f rotate = Matrix3f.createRotation(Quaternionf.fromAngleDegAxis(angle, 0, 1, 0));
   if (halfRotate) {
     offset =
         Matrix3f.createRotation(Quaternionf.fromAngleDegAxis(angle * 0.5f, 0, 1, 0))
             .transform(offset);
   }
   Point[] points = new Point[number];
   for (int i = 0; i < number; i++) {
     points[i] = center.add(offset);
     offset = rotate.transform(offset);
   }
   return points;
 }
Esempio n. 2
0
  @Override
  public Point[] generatePoints(Point center, int number) {

    float angle = 0;
    float distance = 1;

    Point[] points = new Point[number];

    points[0] = center;

    for (int i = 1; i < number; i++) {
      distance = (float) Math.sqrt(i);

      Vector3 offset = Point.FORWARD.transform(MathHelper.rotateY(angle));
      offset = offset.multiply(distance).multiply(scaleRadius);

      points[i] = center.add(offset);

      angle += scaleCircumference * 360.0 / (Math.PI * distance);
    }

    return points;
  }