8#ifndef DESIGNLAB_MATH_LINE_SEGMENT2_H_
9#define DESIGNLAB_MATH_LINE_SEGMENT2_H_
25 constexpr LineSegment2(
float start_x,
float start_y,
float end_x,
float end_y) :
26 start(start_x, start_y),
end(end_x, end_y) {}
38 return !(*
this == other);
constexpr bool IsEqual(const T num1, const T num2) noexcept
C++において,小数同士の計算は誤差が出てしまう. 誤差込みで値が等しいか調べる.
constexpr LineSegment2(float start_x, float start_y, float end_x, float end_y)
Vector2 GetIntersection(const LineSegment2 &other) const
他の線分との交点を求める.
bool CheckAndGetIntersection(const LineSegment2 &other, Vector2 *intersection) const
他の線分と交点が存在しているかどうか調べ,交点を返す関数.
constexpr LineSegment2(const Vector2 &start, const Vector2 &end)
constexpr LineSegment2(const LineSegment2 &other)=default
constexpr LineSegment2(LineSegment2 &&other) noexcept=default
constexpr LineSegment2 & operator=(const LineSegment2 &other)=default
constexpr bool IsParallel(const LineSegment2 &other) const
引数の線分と自身が平行かどうか調べる関数. 全て constexpr 関数で処理できるため非常に高速.
bool HasIntersection(const LineSegment2 &other) const
他の線分と交点が存在しているかどうか調べる関数.
constexpr bool operator==(const LineSegment2 &other) const
constexpr bool operator!=(const LineSegment2 &other) const
float GetLength() const
線分の長さを求める関数.