MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PlacementInputs.cpp
Go to the documentation of this file.
1
#include "
PlacementInputs.hpp
"
2
3
namespace
MayaFlux::Portal::Forma
{
4
5
std::optional<Kinesis::AABB2D>
region_of
(
const
RectPlacementInputs
& placement, std::string& error)
6
{
7
const
glm::vec4 rect = placement.
rect
;
8
if
(!(rect.z > 0.F) || !(rect.w > 0.F)) {
9
error =
"rect needs a positive width and height"
;
10
return
std::nullopt;
11
}
12
return
Kinesis::AABB2D::from_origin_size
({ rect.x, rect.y }, { rect.z, rect.w });
13
}
14
15
std::optional<Kinesis::AABB2D>
region_of
(
const
RadialPlacementInputs
& placement, std::string& error)
16
{
17
if
(!(placement.
radius
> 0.F)) {
18
error =
"radius needs to be positive"
;
19
return
std::nullopt;
20
}
21
return
Kinesis::AABB2D::from_ndc
(placement.
center
, glm::vec2(placement.
radius
));
22
}
23
24
}
PlacementInputs.hpp
MayaFlux::Portal::Forma::region_of
std::optional< Kinesis::AABB2D > region_of(const RectPlacementInputs &placement, std::string &error)
The surface region a rect placement covers.
Definition
PlacementInputs.cpp:5
MayaFlux::Portal::Forma
Definition
Bridge.cpp:16
MayaFlux::Kinesis::AABB2D::from_ndc
static AABB2D from_ndc(glm::vec2 center, glm::vec2 half) noexcept
Definition
Bounds.hpp:94
MayaFlux::Kinesis::AABB2D::from_origin_size
static AABB2D from_origin_size(glm::vec2 origin, glm::vec2 size) noexcept
Construct from a minimum corner and a size.
Definition
Bounds.hpp:104
MayaFlux::Portal::Forma::RadialPlacementInputs::radius
float radius
Definition
PlacementInputs.hpp:26
MayaFlux::Portal::Forma::RadialPlacementInputs::center
glm::vec2 center
Definition
PlacementInputs.hpp:25
MayaFlux::Portal::Forma::RadialPlacementInputs
A placement by center and radius.
Definition
PlacementInputs.hpp:24
MayaFlux::Portal::Forma::RectPlacementInputs::rect
glm::vec4 rect
Definition
PlacementInputs.hpp:15
MayaFlux::Portal::Forma::RectPlacementInputs
A placement by origin and size: x, y, width, height.
Definition
PlacementInputs.hpp:14
src
MayaFlux
Portal
Forma
Manifest
PlacementInputs.cpp
Generated by
1.15.0