OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Line Struct Reference

線分 More...

#include <Line.hpp>

Public Types

using position_type = Vec2
 
using value_type = position_type::value_type
 

Public Member Functions

SIV3D_NODISCARD_CXX20 Line ()=default
 
constexpr SIV3D_NODISCARD_CXX20 Line (value_type x0, value_type y0, value_type x1, value_type y1) noexcept
 
template<class X0 , class Y0 , class X1 , class Y1 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >, std::is_arithmetic< X1 >, std::is_arithmetic< Y1 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Line (X0 x0, Y0 y0, X1 x1, Y1 y1) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Line (position_type p0, value_type x1, value_type y1) noexcept
 
template<class X1 , class Y1 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X1 >, std::is_arithmetic< Y1 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Line (position_type p0, X1 x1, Y1 y1) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Line (value_type x0, value_type y0, position_type p1) noexcept
 
template<class X0 , class Y0 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Line (X0 x0, Y0 y0, position_type p1) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Line (position_type p0, position_type p1) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Line (value_type x0, value_type y0, Arg::direction_< position_type > direction) noexcept
 
template<class X0 , class Y0 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Line (X0 x0, Y0 y0, Arg::direction_< position_type > direction) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Line (position_type origin, Arg::direction_< position_type > direction) noexcept
 
SIV3D_NODISCARD_CXX20 Line (value_type x0, value_type y0, Arg::angle_< value_type > angle, value_type length) noexcept
 
SIV3D_NODISCARD_CXX20 Line (position_type origin, Arg::angle_< value_type > angle, value_type length) noexcept
 
constexpr Lineset (value_type x0, value_type y0, value_type x1, value_type y1) noexcept
 
constexpr Lineset (position_type p0, value_type x1, value_type y1) noexcept
 
constexpr Lineset (value_type x0, value_type y0, position_type p1) noexcept
 
constexpr Lineset (position_type p0, position_type p1) noexcept
 
constexpr Lineset (const Line &line) noexcept
 
constexpr Line movedBy (value_type x, value_type y) const noexcept
 
constexpr Line movedBy (position_type v) const noexcept
 
constexpr LinemoveBy (value_type x, value_type y) noexcept
 
constexpr LinemoveBy (position_type v) noexcept
 
Line stretched (value_type length) const noexcept
 
Line stretched (value_type lengthBegin, value_type lengthEnd) const noexcept
 
constexpr position_type vector () const noexcept
 
position_type normal () const noexcept
 
constexpr Line reversed () const noexcept
 
constexpr Linereverse () noexcept
 
constexpr bool hasLength () const noexcept
 線分が長さを持つかを返します。 More...
 
value_type length () const noexcept
 線分の長さを返します。 More...
 
constexpr value_type lengthSq () const noexcept
 線分の長さの二乗を返します。 More...
 
position_typep (size_t index) noexcept
 
const position_typep (size_t index) const noexcept
 
constexpr position_type point (size_t index) const
 
constexpr position_type position (double t) const noexcept
 
constexpr position_type center () const noexcept
 線分の中心の座標を返します。 More...
 
position_type closest (position_type pos) const noexcept
 
RectF boundingRect () const noexcept
 
Line extractLine (double distanceFromOrigin, double length) const noexcept
 
constexpr Line lerp (const Line &other, double f) const noexcept
 
size_t hash () const noexcept
 
template<class Shape2DType >
constexpr bool intersects (const Shape2DType &other) const
 
template<class Shape2DType >
Optional< Array< Vec2 > > intersectsAt (const Shape2DType &other) const
 
Optional< position_typeintersectsAt (const Line &other) const
 別の線分 other との交点を返します。 More...
 
Optional< position_typeintersectsAtPrecise (const Line &other) const
 別の線分 other との交点を返します。intersectsAt() と異なり、両者の順序が異なっても一致する結果を返します。 More...
 
const Linepaint (Image &dst, const Color &color) const
 
const Linepaint (Image &dst, int32 thickness, const Color &color) const
 
const Lineoverwrite (Image &dst, const Color &color, Antialiased antialiased=Antialiased::Yes) const
 
const Lineoverwrite (Image &dst, int32 thickness, const Color &color, Antialiased antialiased=Antialiased::Yes) const
 
const LinepaintArrow (Image &dst, double width, const Vec2 &headSize, const Color &color) const
 
const LineoverwriteArrow (Image &dst, double width, const Vec2 &headSize, const Color &color) const
 
const LinepaintDoubleHeadedArrow (Image &dst, double width, const Vec2 &headSize, const Color &color) const
 
const LineoverwriteDoubleHeadedArrow (Image &dst, double width, const Vec2 &headSize, const Color &color) const
 
const Linedraw (const ColorF &color=Palette::White) const
 線分を描きます。 More...
 
const Linedraw (const ColorF &colorBegin, const ColorF &colorEnd) const
 線分を描きます。 More...
 
const Linedraw (double thickness, const ColorF &color=Palette::White) const
 線分を描きます。 More...
 
const Linedraw (double thickness, const ColorF &colorBegin, const ColorF &colorEnd) const
 線分を描きます。 More...
 
const Linedraw (const LineStyle &style, double thickness, const ColorF &color=Palette::White) const
 線分を描きます。 More...
 
const Linedraw (const LineStyle &style, double thickness, const ColorF &colorBegin, const ColorF &colorEnd) const
 線分を描きます。 More...
 
const LinedrawArrow (double width=1.0, const SizeF &headSize=SizeF{ 5.0, 5.0 }, const ColorF &color=Palette::White) const
 線分をもとに矢印を描きます。 More...
 
const LinedrawDoubleHeadedArrow (double width=1.0, const SizeF &headSize=SizeF{ 5.0, 5.0 }, const ColorF &color=Palette::White) const
 線分をもとに両方向矢印を描きます。 More...
 

Public Attributes

position_type begin
 線分の開始位置 More...
 
position_type end
 線分の終点位置 More...
 

Friends

constexpr friend bool operator== (const Line &lhs, const Line &rhs) noexcept
 
constexpr friend bool operator!= (const Line &lhs, const Line &rhs) noexcept
 
template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Line &value)
 
template<class CharType >
std::basic_istream< CharType > & operator>> (std::basic_istream< CharType > &input, Line &value)
 
void Formatter (FormatData &formatData, const Line &value)
 

Detailed Description

線分

Member Typedef Documentation

◆ position_type

◆ value_type

Constructor & Destructor Documentation

◆ Line() [1/13]

SIV3D_NODISCARD_CXX20 s3d::Line::Line ( )
default

◆ Line() [2/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( value_type  x0,
value_type  y0,
value_type  x1,
value_type  y1 
)
constexprnoexcept

◆ Line() [3/13]

template<class X0 , class Y0 , class X1 , class Y1 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >, std::is_arithmetic< X1 >, std::is_arithmetic< Y1 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( X0  x0,
Y0  y0,
X1  x1,
Y1  y1 
)
constexprnoexcept

◆ Line() [4/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( position_type  p0,
value_type  x1,
value_type  y1 
)
constexprnoexcept

◆ Line() [5/13]

template<class X1 , class Y1 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X1 >, std::is_arithmetic< Y1 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( position_type  p0,
X1  x1,
Y1  y1 
)
constexprnoexcept

◆ Line() [6/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( value_type  x0,
value_type  y0,
position_type  p1 
)
constexprnoexcept

◆ Line() [7/13]

template<class X0 , class Y0 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( X0  x0,
Y0  y0,
position_type  p1 
)
constexprnoexcept

◆ Line() [8/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( position_type  p0,
position_type  p1 
)
constexprnoexcept

◆ Line() [9/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( value_type  x0,
value_type  y0,
Arg::direction_< position_type direction 
)
constexprnoexcept

◆ Line() [10/13]

template<class X0 , class Y0 , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X0 >, std::is_arithmetic< Y0 >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( X0  x0,
Y0  y0,
Arg::direction_< position_type direction 
)
constexprnoexcept

◆ Line() [11/13]

constexpr SIV3D_NODISCARD_CXX20 s3d::Line::Line ( position_type  origin,
Arg::direction_< position_type direction 
)
constexprnoexcept

◆ Line() [12/13]

SIV3D_NODISCARD_CXX20 s3d::Line::Line ( value_type  x0,
value_type  y0,
Arg::angle_< value_type angle,
value_type  length 
)
noexcept

◆ Line() [13/13]

SIV3D_NODISCARD_CXX20 s3d::Line::Line ( position_type  origin,
Arg::angle_< value_type angle,
value_type  length 
)
noexcept

Member Function Documentation

◆ boundingRect()

RectF s3d::Line::boundingRect ( ) const
noexcept

◆ center()

constexpr position_type s3d::Line::center ( ) const
constexprnoexcept

線分の中心の座標を返します。

Returns
線分の中心の座標

◆ closest()

position_type s3d::Line::closest ( position_type  pos) const
noexcept

◆ draw() [1/6]

const Line& s3d::Line::draw ( const ColorF color = Palette::White) const

線分を描きます。

Parameters
color
Returns
*this

◆ draw() [2/6]

const Line& s3d::Line::draw ( const ColorF colorBegin,
const ColorF colorEnd 
) const

線分を描きます。

Parameters
colorBegin始点側の色
colorEnd終点側の色
Returns
*this

◆ draw() [3/6]

const Line& s3d::Line::draw ( const LineStyle style,
double  thickness,
const ColorF color = Palette::White 
) const

線分を描きます。

Parameters
style線のスタイル
thickness線分の太さ
color
Returns
*this

◆ draw() [4/6]

const Line& s3d::Line::draw ( const LineStyle style,
double  thickness,
const ColorF colorBegin,
const ColorF colorEnd 
) const

線分を描きます。

Parameters
style線のスタイル
thickness線分の太さ
colorBegin始点側の色
colorEnd終点側の色
Returns
*this

◆ draw() [5/6]

const Line& s3d::Line::draw ( double  thickness,
const ColorF color = Palette::White 
) const

線分を描きます。

Parameters
thickness線分の太さ
color
Returns
*this

◆ draw() [6/6]

const Line& s3d::Line::draw ( double  thickness,
const ColorF colorBegin,
const ColorF colorEnd 
) const

線分を描きます。

Parameters
thickness線分の太さ
colorBegin始点側の色
colorEnd終点側の色
Returns
*this

◆ drawArrow()

const Line& s3d::Line::drawArrow ( double  width = 1.0,
const SizeF headSize = SizeF{ 5.0, 5.0 },
const ColorF color = Palette::White 
) const

線分をもとに矢印を描きます。

Parameters
width矢印の線の幅
headSize矢印の三角形のサイズ
color
Returns
*this

◆ drawDoubleHeadedArrow()

const Line& s3d::Line::drawDoubleHeadedArrow ( double  width = 1.0,
const SizeF headSize = SizeF{ 5.0, 5.0 },
const ColorF color = Palette::White 
) const

線分をもとに両方向矢印を描きます。

Parameters
width矢印の線の幅
headSize矢印の三角形のサイズ
color
Returns
*this

◆ extractLine()

Line s3d::Line::extractLine ( double  distanceFromOrigin,
double  length 
) const
noexcept

◆ hash()

size_t s3d::Line::hash ( ) const
noexcept

◆ hasLength()

constexpr bool s3d::Line::hasLength ( ) const
constexprnoexcept

線分が長さを持つかを返します。

Returns
線分が長さを持つ場合 true, それ以外の場合は false

◆ intersects()

template<class Shape2DType >
constexpr bool s3d::Line::intersects ( const Shape2DType &  other) const
constexpr

◆ intersectsAt() [1/2]

Optional<position_type> s3d::Line::intersectsAt ( const Line other) const

別の線分 other との交点を返します。

Parameters
other別の線分
Returns
交差しない場合は none, 交差する場合はその座標、2 つの線分が重なっている場合 (QNaN, QNaN)

◆ intersectsAt() [2/2]

template<class Shape2DType >
Optional<Array<Vec2> > s3d::Line::intersectsAt ( const Shape2DType &  other) const

◆ intersectsAtPrecise()

Optional<position_type> s3d::Line::intersectsAtPrecise ( const Line other) const

別の線分 other との交点を返します。intersectsAt() と異なり、両者の順序が異なっても一致する結果を返します。

Parameters
other別の線分
Returns
交差しない場合は none, 交差する場合はその座標、2 つの線分が重なっている場合 (QNaN, QNaN)

◆ length()

value_type s3d::Line::length ( ) const
noexcept

線分の長さを返します。

Returns
線分の長さ

◆ lengthSq()

constexpr value_type s3d::Line::lengthSq ( ) const
constexprnoexcept

線分の長さの二乗を返します。

Returns
線分の長さの二乗

◆ lerp()

constexpr Line s3d::Line::lerp ( const Line other,
double  f 
) const
constexprnoexcept

◆ moveBy() [1/2]

constexpr Line& s3d::Line::moveBy ( position_type  v)
constexprnoexcept

◆ moveBy() [2/2]

constexpr Line& s3d::Line::moveBy ( value_type  x,
value_type  y 
)
constexprnoexcept

◆ movedBy() [1/2]

constexpr Line s3d::Line::movedBy ( position_type  v) const
constexprnoexcept

◆ movedBy() [2/2]

constexpr Line s3d::Line::movedBy ( value_type  x,
value_type  y 
) const
constexprnoexcept

◆ normal()

position_type s3d::Line::normal ( ) const
noexcept

◆ overwrite() [1/2]

const Line& s3d::Line::overwrite ( Image dst,
const Color color,
Antialiased  antialiased = Antialiased::Yes 
) const

◆ overwrite() [2/2]

const Line& s3d::Line::overwrite ( Image dst,
int32  thickness,
const Color color,
Antialiased  antialiased = Antialiased::Yes 
) const

◆ overwriteArrow()

const Line& s3d::Line::overwriteArrow ( Image dst,
double  width,
const Vec2 headSize,
const Color color 
) const

◆ overwriteDoubleHeadedArrow()

const Line& s3d::Line::overwriteDoubleHeadedArrow ( Image dst,
double  width,
const Vec2 headSize,
const Color color 
) const

◆ p() [1/2]

const position_type& s3d::Line::p ( size_t  index) const
noexcept

◆ p() [2/2]

position_type& s3d::Line::p ( size_t  index)
noexcept

◆ paint() [1/2]

const Line& s3d::Line::paint ( Image dst,
const Color color 
) const

◆ paint() [2/2]

const Line& s3d::Line::paint ( Image dst,
int32  thickness,
const Color color 
) const

◆ paintArrow()

const Line& s3d::Line::paintArrow ( Image dst,
double  width,
const Vec2 headSize,
const Color color 
) const

◆ paintDoubleHeadedArrow()

const Line& s3d::Line::paintDoubleHeadedArrow ( Image dst,
double  width,
const Vec2 headSize,
const Color color 
) const

◆ point()

constexpr position_type s3d::Line::point ( size_t  index) const
constexpr

◆ position()

constexpr position_type s3d::Line::position ( double  t) const
constexprnoexcept

◆ reverse()

constexpr Line& s3d::Line::reverse ( )
constexprnoexcept

◆ reversed()

constexpr Line s3d::Line::reversed ( ) const
constexprnoexcept

◆ set() [1/5]

constexpr Line& s3d::Line::set ( const Line line)
constexprnoexcept

◆ set() [2/5]

constexpr Line& s3d::Line::set ( position_type  p0,
position_type  p1 
)
constexprnoexcept

◆ set() [3/5]

constexpr Line& s3d::Line::set ( position_type  p0,
value_type  x1,
value_type  y1 
)
constexprnoexcept

◆ set() [4/5]

constexpr Line& s3d::Line::set ( value_type  x0,
value_type  y0,
position_type  p1 
)
constexprnoexcept

◆ set() [5/5]

constexpr Line& s3d::Line::set ( value_type  x0,
value_type  y0,
value_type  x1,
value_type  y1 
)
constexprnoexcept

◆ stretched() [1/2]

Line s3d::Line::stretched ( value_type  length) const
noexcept

◆ stretched() [2/2]

Line s3d::Line::stretched ( value_type  lengthBegin,
value_type  lengthEnd 
) const
noexcept

◆ vector()

constexpr position_type s3d::Line::vector ( ) const
constexprnoexcept

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
const Line value 
)
friend

◆ operator!=

constexpr friend bool operator!= ( const Line lhs,
const Line rhs 
)
friend

◆ operator<<

template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Line value 
)
friend

◆ operator==

constexpr friend bool operator== ( const Line lhs,
const Line rhs 
)
friend

◆ operator>>

template<class CharType >
std::basic_istream<CharType>& operator>> ( std::basic_istream< CharType > &  input,
Line value 
)
friend

Member Data Documentation

◆ begin

position_type s3d::Line::begin

線分の開始位置

◆ end

position_type s3d::Line::end

線分の終点位置


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