Ellipse.ixx File
Basic ellipse shape for 2D rendering. More...
Included Headers
#include <vector>
#include <cmath>
#include <numbers>
#include <helios.rendering.mesh.PrimitiveType>
#include <helios.math.types>
#include <helios.rendering.Vertex>
#include <helios.rendering.asset.shape.Shape>
Namespaces Index
| namespace | helios |
| namespace | rendering |
|
Graphics rendering infrastructure. More... | |
| namespace | asset |
|
Rendering asset management. More... | |
| namespace | shape |
|
Geometric shape definitions. More... | |
| namespace | basic |
|
Basic primitive shapes. More... | |
Classes Index
| struct | Ellipse |
Description
Basic ellipse shape for 2D rendering.
File Listing
The file content with the documentation metadata removed is:
18using namespace helios::rendering;
20export namespace helios::rendering::asset::shape::basic {
45 static std::vector<Vertex> generateVertices(float radiusX, float radiusY, unsigned int segments) {
46 std::vector<Vertex> vertices;
48 vertices.reserve(segments + 1);
51 vertices.push_back({
60 const float angle = (static_cast<float>(i) / static_cast<float>(segments)) * 2.0f * std::numbers::pi_v<float>;
71 vertices.push_back({
77 return vertices;
89 std::vector<unsigned int> indices;
90 indices.reserve(segments * 3); // 'segments' triangles, 3 indices per triangle
93 indices.push_back(0); // center vertex
94 indices.push_back(i); // current circumference vertex
99 indices.push_back(next_i);
101 return indices;
119 Shape(
128 [[nodiscard]] helios::rendering::mesh::PrimitiveType primitiveType() const noexcept override {
129 return mesh::PrimitiveType::Triangles;
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.