Skip to content
Daisuke YAMAGUCHI edited this page Oct 26, 2015 · 47 revisions

要約

ベクトルを扱うためのクラスです。これは Open CASCADE の gp_Vec クラスの機能をラッピングしたクラスであり、Ruby の Vector クラスとは別のものです。

特異メソッド

  • new(x, y, z) -> Vec

    • Vec オブジェクトを作成します。 引数を省略すると、 [0, 0, 0] の要素を持つベクトルが作成されます。
  • zero -> Vec, origin -> Vec

    • [0, 0, 0] の要素のベクトルを返します。
  • xdir -> Vec, ydir -> Vec, zdir -> Vec

    • それぞれ [1, 0, 0], [0, 1, 0], [0, 0, 1] の要素のベクトルを返します。

インスタンスメソッド

  • self == other -> bool

  • self + other -> Vec

  • self - other -> Vec

  • -self -> Vec

  • self * float -> Vec

  • self / float -> Vec

  • inspect -> String, to_s -> String

    • Vec オブジェクトが保持している要素を人間が読める文字列にして返します。
  • x -> float, x=float

    • X の値を取得、設定します。
  • y -> float, y=float

    • Y の値を取得、設定します。
  • z -> float, z=float

    • Z の値を取得、設定します。
  • to_a -> nil, to_ary -> nil, to_xyz -> nil

    • ベクトルを X, Y, Z の要素を並べた Array オブジェクトにして返します。
  • equal?(Vec) -> bool

    • .
  • normal?(Vec) -> bool

    • .
  • opposite? -> bool

    • .
  • parallel? -> bool

    • .
  • normalize -> nil

    • .
  • normalize! -> nil

    • .
  • reverse -> nil

    • .
  • reverse! -> nil

    • .
  • angle -> nil

    • .
  • magnitude -> nil

    • .
  • size -> nil

    • .
  • length -> nil

    • .

Clone this wiki locally