-
Notifications
You must be signed in to change notification settings - Fork 4
class Vertex
Daisuke YAMAGUCHI edited this page Nov 1, 2016
·
7 revisions
Siren::Vertex (バーテックス) とは、3次元の点を表わすオブジェクトです。Siren::Shape クラスの派生クラスです。
new(x = 0.0, y = 0.0, z = 0.0) -> Vertex
new([x, y, z]) -> Vertex
座標 x, y, z の位置に Siren::Vertex オブジェクトを生成します。省略した後は 0.0 になります。
例)
v1 = Siren::Vertex.new
v2 = Siren::Vertex.new 1, 0, 2
pos = [5, 2, 1.5]
v3 = Siren::Vertex.new pos
xyz -> [x, y, z]
to_a -> [x, y, z]
Siren::Vertex の3次元座標値を配列として返します。
point = Siren.vertex [1, 2, 3]
p point.xyz # => [1, 2, 3]
p point.to_a # => [1, 2, 3]
to_v -> Vec
バーテックスの3次元座標値の x, y, z 要素を持つ Vec 型のオブジェクトを返します。
point = Siren.vertex [1, 2, 3]
p point.to_v # => #<Vec:0x1f9bf50 @x=1.000000, @y=2.000000, @z=3.000000>