rotateInPlace method

Sp3dFace rotateInPlace(
  1. Sp3dObj parent,
  2. Sp3dV3D norAxis,
  3. double radian
)

(en)Rotates all vectors of this face based on the specified axis. Unlike rotate, rotateInPlace rotates around the mean coordinates of this face as the origin.

(ja)この面の全てのベクトルを指定した軸をベースに回転させます。 rotateとは異なり、rotateInPlace はこの面の平均座標を原点として回転します。

  • parent : parent obj.
  • norAxis : normalized rotate axis vector.
  • radian : radian = degree * pi / 180.

Implementation

Sp3dFace rotateInPlace(Sp3dObj parent, Sp3dV3D norAxis, double radian) {
  final Sp3dV3D center = getCenter(parent);
  final Sp3dV3D diff = Sp3dV3D(0, 0, 0) - center;
  move(parent, diff);
  rotate(parent, norAxis, radian);
  move(parent, diff * -1);
  return this;
}