Lumino
ln::Plane Struct Reference

平面を定義します。 More...

#include <Plane.hpp>

Public Member Functions

 Plane ()
 各要素に 0.0 を設定してインスタンスを初期化します。
 
 Plane (float a, float b, float c, float d)
 各要素を指定してインスタンスを初期化します。 More...
 
 Plane (const Vector3 &point, const Vector3 &normal)
 平面上の1点と法線を指定してインスタンスを初期化します。 More...
 
 Plane (const Vector3 &point1, const Vector3 &point2, const Vector3 &point3)
 平面上の3点を指定してインスタンスを初期化します。 More...
 
void normalize ()
 この平面を正規化します。 More...
 
bool checkInside (const Vector3 &point) const
 点がこの平面の裏側にあるかを判定します。点が面上にある場合は表側と判定します。 More...
 
bool checkInsideLower (const Vector3 &point) const
 点がこの平面の裏側にあるかを判定します。点が面上にある場合も裏側と判定します。 More...
 
bool checkInside (const Vector3 &point, float radius) const
 球がこの平面の裏側にあるかを判定します。 More...
 
bool intersects (const Vector3 &start, const Vector3 &end, Vector3 *point=nullptr) const
 この平面と線分が交差するかを判定します。 More...
 
bool intersects (const Ray &ray, Vector3 *point=nullptr) const
 この平面とレイが交差するかを判定します。 More...
 
void transform (const Matrix &mat)
 指定された行列を使用してこの平面を座標変換します。 More...
 
float getDistanceToPoint (const Vector3 &point) const
 指定した点と平面の距離を計算します。 More...
 

Static Public Member Functions

static Plane normalize (const Plane &plane)
 正規化した平面を返します。 More...
 
static float dot (const Plane &plane, const Vector4 &vec)
 平面と 4D ベクトルの内積を計算します。 More...
 
static float dotCoord (const Plane &plane, const Vector3 &vec)
 平面と 3D ベクトルの内積を計算します。(ベクトルの W を 1.0 として計算する) More...
 
static float dotNormal (const Plane &plane, const Vector3 &vec)
 平面と 3D ベクトルの内積を計算します。(ベクトルの W を 0.0 として計算する) More...
 
static Plane transform (const Plane &plane, const Matrix &mat)
 指定された行列を使用して平面を座標変換します。 More...
 

Public Attributes

Vector3 normal
 Plane の法線 ベクトル
 
float distance
 原点からの法線に沿った Plane の距離
 

Detailed Description

平面を定義します。

Constructor & Destructor Documentation

◆ Plane() [1/3]

ln::Plane::Plane ( float  a,
float  b,
float  c,
float  d 
)

各要素を指定してインスタンスを初期化します。

Parameters
[in]a: 法線の X 成分
[in]b: 法線の Y 成分
[in]c: 法線の Z 成分
[in]d: 原点からの法線に沿った Plane の距離

◆ Plane() [2/3]

ln::Plane::Plane ( const Vector3 point,
const Vector3 normal 
)

平面上の1点と法線を指定してインスタンスを初期化します。

Parameters
[in]point: 平面上の点
[in]normal: 法線 (正規化済みであること)

◆ Plane() [3/3]

ln::Plane::Plane ( const Vector3 point1,
const Vector3 point2,
const Vector3 point3 
)

平面上の3点を指定してインスタンスを初期化します。

Parameters
[in]point1: 平面上の点1
[in]point2: 平面上の点2
[in]point3: 平面上の点3

Member Function Documentation

◆ checkInside() [1/2]

bool ln::Plane::checkInside ( const Vector3 point) const
inline

点がこの平面の裏側にあるかを判定します。点が面上にある場合は表側と判定します。

Parameters
[in]point: 判定する点の座標
Returns
true の場合、裏側にある

面は法線が伸びている方が表側です。

◆ checkInside() [2/2]

bool ln::Plane::checkInside ( const Vector3 point,
float  radius 
) const
inline

球がこの平面の裏側にあるかを判定します。

Parameters
[in]point: 球の中心座標
[in]radius: 球の半径
Returns
true の場合、裏側にある (接触している場合も true)

面は法線が伸びている方が表側です。

◆ checkInsideLower()

bool ln::Plane::checkInsideLower ( const Vector3 point) const
inline

点がこの平面の裏側にあるかを判定します。点が面上にある場合も裏側と判定します。

Parameters
[in]point: 判定する点の座標
Returns
true の場合、裏側にある

◆ dot()

static float ln::Plane::dot ( const Plane plane,
const Vector4 vec 
)
static

平面と 4D ベクトルの内積を計算します。

Parameters
[in]plane: 処理の基になる平面
[in]vec: 処理の基になるベクトル

◆ dotCoord()

static float ln::Plane::dotCoord ( const Plane plane,
const Vector3 vec 
)
static

平面と 3D ベクトルの内積を計算します。(ベクトルの W を 1.0 として計算する)

Parameters
[in]plane: 処理の基になる平面
[in]vec: 処理の基になるベクトル

戻り値が正の値である場合、点は平面の表側になります。

◆ dotNormal()

static float ln::Plane::dotNormal ( const Plane plane,
const Vector3 vec 
)
static

平面と 3D ベクトルの内積を計算します。(ベクトルの W を 0.0 として計算する)

Parameters
[in]plane: 処理の基になる平面
[in]vec: 処理の基になるベクトル

◆ getDistanceToPoint()

float ln::Plane::getDistanceToPoint ( const Vector3 point) const
inline

指定した点と平面の距離を計算します。

戻り値の符号で点と平面の位置関係を表します。負値の場合、点は平面の裏側にあります。 単純に距離を知りたい場合は戻り値の絶対値を取ってください。

◆ intersects() [1/2]

bool ln::Plane::intersects ( const Vector3 start,
const Vector3 end,
Vector3 point = nullptr 
) const

この平面と線分が交差するかを判定します。

Parameters
[in]start: 線分の始点
[in]end: 線分の終点
[in]point: 交点の座標を格納するベクトルのポインタ
Returns
交差する場合は true、平行な場合は false

◆ intersects() [2/2]

bool ln::Plane::intersects ( const Ray ray,
Vector3 point = nullptr 
) const

この平面とレイが交差するかを判定します。

Parameters
[in]ray: レイ
[in]point: 交点の座標を格納するベクトルのポインタ
Returns
交差する場合は true、平行な場合は false

◆ normalize() [1/2]

void ln::Plane::normalize ( )

この平面を正規化します。

面法線 Normal を正規化し、それに使用した係数を distance にも適用します。

◆ normalize() [2/2]

static Plane ln::Plane::normalize ( const Plane plane)
static

正規化した平面を返します。

Parameters
[in]plane: 処理の基になる平面
Returns
正規化された平面

面法線 Normal を正規化し、それに使用した係数を distance にも適用します。

◆ transform() [1/2]

void ln::Plane::transform ( const Matrix mat)

指定された行列を使用してこの平面を座標変換します。

Parameters
[in]mat: 処理の基になる行列

◆ transform() [2/2]

static Plane ln::Plane::transform ( const Plane plane,
const Matrix mat 
)
static

指定された行列を使用して平面を座標変換します。

Parameters
[in]plane: 処理の基になる平面
[in]mat: 処理の基になる行列
Returns
変換された平面

The documentation for this struct was generated from the following file: