Common geometry types.
More...
#include <algorithm>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <optional>
#include <type_traits>
#include <vector>
Go to the source code of this file.
|
| template<typename T > |
| Vec2< T >::Real | asw::geometry::signed_area (const Polygon< T > &polygon) |
| | Get the signed area of a polygon.
|
| |
| template<typename T > |
| Quad< T > | asw::geometry::bounds (const Polygon< T > &polygon) |
| | Get the smallest rectangle that holds every corner of a polygon.
|
| |
| template<typename T > |
| bool | asw::geometry::point_in_triangle (const Vec2< T > &point, const Vec2< T > &a, const Vec2< T > &b, const Vec2< T > &c) |
| | Check if a point is inside a triangle. Points on an edge are inside.
|
| |
| std::optional< float > | asw::geometry::ray_hit (const Vec2f &origin, const Vec2f &direction, const Vec2f &a, const Vec2f &b) |
| | Find where a ray hits a line segment.
|
| |
| Polygonf | asw::geometry::visibility (const Vec2f &from, float radius, const std::vector< Polygonf > &occluders, float direction=0.0F, float cone=0.0F) |
| | Find the area that can be seen from a point.
|
| |
| void | asw::geometry::visibility (Polygonf &result, const Vec2f &from, float radius, const std::vector< Polygonf > &occluders, float direction=0.0F, float cone=0.0F) |
| | Find the area that can be seen from a point, into a polygon you keep between calls so it does not allocate each time.
|
| |
| void | asw::geometry::visibility (Polygonf &result, const Vec2f &from, float radius, const std::vector< Polygonf > &occluders, const std::vector< Quadf > &occluder_bounds, float direction=0.0F, float cone=0.0F) |
| | Find the area that can be seen from a point, with the bounds of the occluders already worked out, e.g. once per frame for many lights.
|
| |
Common geometry types.
- Author
- Allan Legemaate (alege.nosp@m.maat.nosp@m.e@gma.nosp@m.il.c.nosp@m.om)
- Date
- 2025-03-26
- Copyright
- Copyright (c) 2025
Definition in file geometry.h.