mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 07:23:26 +00:00
updated comments
This commit is contained in:
@@ -238,9 +238,7 @@ namespace omath::projection
|
|||||||
return std::ranges::any_of(ndc.raw_array(), [](const auto& val) { return val < -1 || val > 1; });
|
return std::ranges::any_of(ndc.raw_array(), [](const auto& val) { return val < -1 || val > 1; });
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Vector3<float>
|
// NDC REPRESENTATION:
|
||||||
ndc_to_screen_position_from_top_left_corner(const Vector3<float>& ndc) const noexcept
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
^
|
^
|
||||||
| y
|
| y
|
||||||
@@ -254,6 +252,20 @@ namespace omath::projection
|
|||||||
v
|
v
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
[[nodiscard]] Vector3<float>
|
||||||
|
ndc_to_screen_position_from_top_left_corner(const Vector3<float>& ndc) const noexcept
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
+------------------------>
|
||||||
|
| (0, 0)
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
⌄
|
||||||
|
*/
|
||||||
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (ndc.y / -2.f + 0.5f) * m_view_port.m_height, ndc.z};
|
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (ndc.y / -2.f + 0.5f) * m_view_port.m_height, ndc.z};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,17 +274,15 @@ namespace omath::projection
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
^
|
^
|
||||||
| y
|
|
||||||
1 |
|
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
-1 ---------0--------- 1 --> x
|
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
-1 |
|
|
|
||||||
v
|
|
|
||||||
|
| (0, 0)
|
||||||
|
+------------------------>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (ndc.y / 2.f + 0.5f) * m_view_port.m_height, ndc.z};
|
return {(ndc.x + 1.f) / 2.f * m_view_port.m_width, (ndc.y / 2.f + 0.5f) * m_view_port.m_height, ndc.z};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
include/omath/projection/utility.hpp
Normal file
5
include/omath/projection/utility.hpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by Vlad on 10/23/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
Reference in New Issue
Block a user