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

#include <Box.hpp>

Public Types

using position_type = Vec3
 
using size_type = Vec3
 
using value_type = size_type::value_type
 

Public Member Functions

SIV3D_NODISCARD_CXX20 Box ()=default
 
constexpr SIV3D_NODISCARD_CXX20 Box (double _size) noexcept
 
SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 Box (Arithmetic _size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (double _w, double _h, double _d) noexcept
 
template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Box (W _w, H _h, D _d) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (double cx, double cy, double cz, double _size) noexcept
 
template<class X , class Y , class Z , class S , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >, std::is_arithmetic< S >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Box (X cx, Y cy, Z cz, S _size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (double cx, double cy, double cz, double _w, double _h, double _d) noexcept
 
template<class X , class Y , class Z , class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >, std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr Box (X cx, Y cy, Z cz, W _w, H _h, D _d) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (double cx, double cy, double cz, const Vec3 &_size) noexcept
 
template<class X , class Y , class Z , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Box (X cx, Y cy, Z cz, const Vec3 &_size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_center, double _size) noexcept
 
SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_center, Arithmetic _size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_center, double _w, double _h, double _d) noexcept
 
template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_center, W _w, H _h, D _d) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (const Vec3 &_center, const Vec3 &_size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (Arg::bottomCenter_< Vec3 > _center, double _size) noexcept
 
SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 Box (Arg::bottomCenter_< Vec3 > _center, Arithmetic _size) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (Arg::bottomCenter_< Vec3 > _center, double _w, double _h, double _d) noexcept
 
template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 Box (Arg::bottomCenter_< Vec3 > _center, W _w, H _h, D _d) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Box (Arg::bottomCenter_< Vec3 > _center, const Vec3 &_size) noexcept
 
constexpr BoxsetPos (value_type cx, value_type cy, value_type cz) noexcept
 
constexpr BoxsetPos (position_type _center) noexcept
 
constexpr BoxsetSize (value_type _w, value_type _h, value_type _d) noexcept
 
constexpr BoxsetSize (size_type _size) noexcept
 
constexpr Box movedBy (value_type _x, value_type _y, value_type _z) const noexcept
 
constexpr Box movedBy (size_type v) const noexcept
 
constexpr BoxmoveBy (value_type _x, value_type _y, value_type _z) noexcept
 
constexpr BoxmoveBy (size_type v) noexcept
 
constexpr Box stretched (double xyz) const noexcept
 
constexpr Box stretched (double _x, double _y, double _z) const noexcept
 
constexpr Box stretched (Vec3 xyz) const noexcept
 
constexpr Box scaled (double s) const noexcept
 
constexpr Box scaled (double sx, double sy, double sz) const noexcept
 
constexpr Box scaled (Vec3 s) const noexcept
 
constexpr bool hasVolume () const noexcept
 
std::array< Vec3, 8 > getCorners () const noexcept
 
constexpr Box lerp (const Box &other, double f) const noexcept
 
OrientedBox oriented (const Quaternion &orientation) const noexcept
 
constexpr position_type topCenter () const noexcept
 
constexpr position_type bottomCenter () const noexcept
 
bool intersects (const Vec3 &point) const noexcept
 
bool intersects (const Triangle3D &triangle) const noexcept
 
bool intersects (const Sphere &sphere) const noexcept
 
bool intersects (const Box &box) const noexcept
 
bool intersects (const OrientedBox &box) const noexcept
 
bool intersects (const ViewFrustum &frustum) const noexcept
 
Optional< float > intersects (const Ray &ray) const noexcept
 
bool contains (const Vec3 &point) const noexcept
 
bool contains (const Triangle3D &triangle) const noexcept
 
bool contains (const Sphere &sphere) const noexcept
 
bool contains (const Box &box) const noexcept
 
bool contains (const OrientedBox &box) const noexcept
 
bool contains (const ViewFrustum &frustum) const noexcept
 
const Boxdraw (const ColorF &color=Palette::White) const
 
const Boxdraw (const Texture &texture, const ColorF &color=Palette::White) const
 
const Boxdraw (const TextureRegion &textureRegion, const ColorF &color=Palette::White) const
 
const Boxdraw (const Quaternion &rotation, const ColorF &color=Palette::White) const
 
const Boxdraw (const Quaternion &rotation, const Texture &texture, const ColorF &color=Palette::White) const
 
const Boxdraw (const Quaternion &rotation, const TextureRegion &textureRegion, const ColorF &color=Palette::White) const
 
const Boxdraw (const Mat4x4 &mat, const ColorF &color=Palette::White) const
 
const Boxdraw (const Mat4x4 &mat, const Texture &texture, const ColorF &color=Palette::White) const
 
const Boxdraw (const Mat4x4 &mat, const TextureRegion &textureRegion, const ColorF &color=Palette::White) const
 
const Boxdraw (const PhongMaterial &material) const
 
const Boxdraw (const Texture &texture, const PhongMaterial &material) const
 
const Boxdraw (const TextureRegion &textureRegion, const PhongMaterial &material) const
 
const Boxdraw (const Quaternion &rotation, const PhongMaterial &material) const
 
const Boxdraw (const Quaternion &rotation, const Texture &texture, const PhongMaterial &material) const
 
const Boxdraw (const Quaternion &rotation, const TextureRegion &textureRegion, const PhongMaterial &material) const
 
const Boxdraw (const Mat4x4 &mat, const PhongMaterial &material) const
 
const Boxdraw (const Mat4x4 &mat, const Texture &texture, const PhongMaterial &material) const
 
const Boxdraw (const Mat4x4 &mat, const TextureRegion &textureRegion, const PhongMaterial &material) const
 
const BoxdrawFrame (const ColorF &color=Palette::White) const
 

Static Public Member Functions

static constexpr Box FromPoints (const Vec3 &a, const Vec3 &b) noexcept
 

Public Attributes

union {
   position_type   center
 
   struct {
      value_type   x
 
      value_type   y
 
      value_type   z
 
   } 
 
}; 
 
union {
   position_type   size
 
   struct {
      value_type   w
 
      value_type   h
 
      value_type   d
 
   } 
 
}; 
 

Friends

template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Box &value)
 
template<class CharType >
std::basic_istream< CharType > & operator>> (std::basic_istream< CharType > &input, Box &value)
 
void Formatter (FormatData &formatData, const Box &value)
 

Member Typedef Documentation

◆ position_type

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ Box() [1/22]

SIV3D_NODISCARD_CXX20 s3d::Box::Box ( )
default

◆ Box() [2/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( double  _size)
explicitconstexprnoexcept

◆ Box() [3/22]

SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arithmetic  _size)
explicitconstexprnoexcept

◆ Box() [4/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( double  _w,
double  _h,
double  _d 
)
constexprnoexcept

◆ Box() [5/22]

template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( _w,
_h,
_d 
)
explicitconstexprnoexcept

◆ Box() [6/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _size)
explicitconstexprnoexcept

◆ Box() [7/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( double  cx,
double  cy,
double  cz,
double  _size 
)
constexprnoexcept

◆ Box() [8/22]

template<class X , class Y , class Z , class S , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >, std::is_arithmetic< S >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( cx,
cy,
cz,
_size 
)
constexprnoexcept

◆ Box() [9/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( double  cx,
double  cy,
double  cz,
double  _w,
double  _h,
double  _d 
)
constexprnoexcept

◆ Box() [10/22]

template<class X , class Y , class Z , class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >, std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr s3d::Box::Box ( cx,
cy,
cz,
_w,
_h,
_d 
)
constexprnoexcept

◆ Box() [11/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( double  cx,
double  cy,
double  cz,
const Vec3 _size 
)
constexprnoexcept

◆ Box() [12/22]

template<class X , class Y , class Z , std::enable_if_t< std::conjunction_v< std::is_arithmetic< X >, std::is_arithmetic< Y >, std::is_arithmetic< Z >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( cx,
cy,
cz,
const Vec3 _size 
)
constexprnoexcept

◆ Box() [13/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _center,
double  _size 
)
constexprnoexcept

◆ Box() [14/22]

SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _center,
Arithmetic  _size 
)
constexprnoexcept

◆ Box() [15/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _center,
double  _w,
double  _h,
double  _d 
)
constexprnoexcept

◆ Box() [16/22]

template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _center,
_w,
_h,
_d 
)
constexprnoexcept

◆ Box() [17/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( const Vec3 _center,
const Vec3 _size 
)
constexprnoexcept

◆ Box() [18/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arg::bottomCenter_< Vec3 _center,
double  _size 
)
constexprnoexcept

◆ Box() [19/22]

SIV3D_CONCEPT_ARITHMETIC constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arg::bottomCenter_< Vec3 _center,
Arithmetic  _size 
)
constexprnoexcept

◆ Box() [20/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arg::bottomCenter_< Vec3 _center,
double  _w,
double  _h,
double  _d 
)
constexprnoexcept

◆ Box() [21/22]

template<class W , class H , class D , std::enable_if_t< std::conjunction_v< std::is_arithmetic< W >, std::is_arithmetic< H >, std::is_arithmetic< D >>> * = nullptr>
constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arg::bottomCenter_< Vec3 _center,
_w,
_h,
_d 
)
constexprnoexcept

◆ Box() [22/22]

constexpr SIV3D_NODISCARD_CXX20 s3d::Box::Box ( Arg::bottomCenter_< Vec3 _center,
const Vec3 _size 
)
constexprnoexcept

Member Function Documentation

◆ bottomCenter()

constexpr position_type s3d::Box::bottomCenter ( ) const
constexprnoexcept

◆ contains() [1/6]

bool s3d::Box::contains ( const Box box) const
noexcept

◆ contains() [2/6]

bool s3d::Box::contains ( const OrientedBox box) const
noexcept

◆ contains() [3/6]

bool s3d::Box::contains ( const Sphere sphere) const
noexcept

◆ contains() [4/6]

bool s3d::Box::contains ( const Triangle3D triangle) const
noexcept

◆ contains() [5/6]

bool s3d::Box::contains ( const Vec3 point) const
noexcept

◆ contains() [6/6]

bool s3d::Box::contains ( const ViewFrustum frustum) const
noexcept

◆ draw() [1/18]

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

◆ draw() [2/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const ColorF color = Palette::White 
) const

◆ draw() [3/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const PhongMaterial material 
) const

◆ draw() [4/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const Texture texture,
const ColorF color = Palette::White 
) const

◆ draw() [5/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const Texture texture,
const PhongMaterial material 
) const

◆ draw() [6/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const TextureRegion textureRegion,
const ColorF color = Palette::White 
) const

◆ draw() [7/18]

const Box& s3d::Box::draw ( const Mat4x4 mat,
const TextureRegion textureRegion,
const PhongMaterial material 
) const

◆ draw() [8/18]

const Box& s3d::Box::draw ( const PhongMaterial material) const

◆ draw() [9/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const ColorF color = Palette::White 
) const

◆ draw() [10/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const PhongMaterial material 
) const

◆ draw() [11/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const Texture texture,
const ColorF color = Palette::White 
) const

◆ draw() [12/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const Texture texture,
const PhongMaterial material 
) const

◆ draw() [13/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const TextureRegion textureRegion,
const ColorF color = Palette::White 
) const

◆ draw() [14/18]

const Box& s3d::Box::draw ( const Quaternion rotation,
const TextureRegion textureRegion,
const PhongMaterial material 
) const

◆ draw() [15/18]

const Box& s3d::Box::draw ( const Texture texture,
const ColorF color = Palette::White 
) const

◆ draw() [16/18]

const Box& s3d::Box::draw ( const Texture texture,
const PhongMaterial material 
) const

◆ draw() [17/18]

const Box& s3d::Box::draw ( const TextureRegion textureRegion,
const ColorF color = Palette::White 
) const

◆ draw() [18/18]

const Box& s3d::Box::draw ( const TextureRegion textureRegion,
const PhongMaterial material 
) const

◆ drawFrame()

const Box& s3d::Box::drawFrame ( const ColorF color = Palette::White) const

◆ FromPoints()

static constexpr Box s3d::Box::FromPoints ( const Vec3 a,
const Vec3 b 
)
staticconstexprnoexcept

◆ getCorners()

std::array<Vec3, 8> s3d::Box::getCorners ( ) const
noexcept

◆ hasVolume()

constexpr bool s3d::Box::hasVolume ( ) const
constexprnoexcept

◆ intersects() [1/7]

bool s3d::Box::intersects ( const Box box) const
noexcept

◆ intersects() [2/7]

bool s3d::Box::intersects ( const OrientedBox box) const
noexcept

◆ intersects() [3/7]

Optional<float> s3d::Box::intersects ( const Ray ray) const
noexcept

◆ intersects() [4/7]

bool s3d::Box::intersects ( const Sphere sphere) const
noexcept

◆ intersects() [5/7]

bool s3d::Box::intersects ( const Triangle3D triangle) const
noexcept

◆ intersects() [6/7]

bool s3d::Box::intersects ( const Vec3 point) const
noexcept

◆ intersects() [7/7]

bool s3d::Box::intersects ( const ViewFrustum frustum) const
noexcept

◆ lerp()

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

◆ moveBy() [1/2]

constexpr Box& s3d::Box::moveBy ( size_type  v)
constexprnoexcept

◆ moveBy() [2/2]

constexpr Box& s3d::Box::moveBy ( value_type  _x,
value_type  _y,
value_type  _z 
)
constexprnoexcept

◆ movedBy() [1/2]

constexpr Box s3d::Box::movedBy ( size_type  v) const
constexprnoexcept

◆ movedBy() [2/2]

constexpr Box s3d::Box::movedBy ( value_type  _x,
value_type  _y,
value_type  _z 
) const
constexprnoexcept

◆ oriented()

OrientedBox s3d::Box::oriented ( const Quaternion orientation) const
noexcept

◆ scaled() [1/3]

constexpr Box s3d::Box::scaled ( double  s) const
constexprnoexcept

◆ scaled() [2/3]

constexpr Box s3d::Box::scaled ( double  sx,
double  sy,
double  sz 
) const
constexprnoexcept

◆ scaled() [3/3]

constexpr Box s3d::Box::scaled ( Vec3  s) const
constexprnoexcept

◆ setPos() [1/2]

constexpr Box& s3d::Box::setPos ( position_type  _center)
constexprnoexcept

◆ setPos() [2/2]

constexpr Box& s3d::Box::setPos ( value_type  cx,
value_type  cy,
value_type  cz 
)
constexprnoexcept

◆ setSize() [1/2]

constexpr Box& s3d::Box::setSize ( size_type  _size)
constexprnoexcept

◆ setSize() [2/2]

constexpr Box& s3d::Box::setSize ( value_type  _w,
value_type  _h,
value_type  _d 
)
constexprnoexcept

◆ stretched() [1/3]

constexpr Box s3d::Box::stretched ( double  _x,
double  _y,
double  _z 
) const
constexprnoexcept

◆ stretched() [2/3]

constexpr Box s3d::Box::stretched ( double  xyz) const
constexprnoexcept

◆ stretched() [3/3]

constexpr Box s3d::Box::stretched ( Vec3  xyz) const
constexprnoexcept

◆ topCenter()

constexpr position_type s3d::Box::topCenter ( ) const
constexprnoexcept

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
const Box value 
)
friend

◆ operator<<

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

◆ operator>>

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

Member Data Documentation

◆ @1

union { ... }

◆ @3

union { ... }

◆ center

position_type s3d::Box::center

◆ d

value_type s3d::Box::d

◆ h

value_type s3d::Box::h

◆ size

position_type s3d::Box::size

◆ w

value_type s3d::Box::w

◆ x

value_type s3d::Box::x

◆ y

value_type s3d::Box::y

◆ z

value_type s3d::Box::z

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