convert method

  1. @override
List<Sp3dV2D> convert(
  1. Sp3dObj obj,
  2. Sp3dV2D origin
)
override

(en)Take a picture of an object on the world with this camera. The vertex coordinates of the object are converted to 2D coordinates for screen display and returned.

(ja)カメラでワールド上のオブジェクトを撮影します。オブジェクトの頂点座標が画面表示用の2次元の座標に変換されて返されます。

  • obj : Sp3dObj in the world.
  • origin : The world origin in canvas.

Returns Clip coordinates.

Implementation

@override
List<Sp3dV2D> convert(Sp3dObj obj, Sp3dV2D origin) {
  List<Sp3dV2D> r = [];
  for (Sp3dV3D i in obj.vertices) {
    final Sp3dV3D v = i.rotated(rotateAxis, radian);
    r.add(Sp3dV2D(
        origin.x + (v.x - position.x), origin.y + (position.y - v.y)));
  }
  return r;
}