VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
primitives.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 21.07.2025.
5//
6
7#pragma once
8
9#include <numbers>
10
11#include "matrix4.h"
12#include "vector3.h"
13
14namespace visutwin::canvas
15{
16 /*
17 * A sphere primitive, representing the set of all points some distance from the origin
18 */
19 struct Sphere
20 {
21 float radius;
22 };
23
24 struct Frustum
25 {
27
28 void create(const Matrix4& viewProjection);
29
30 [[nodiscard]] bool checkPoint(const Vector3&) const;
31 [[nodiscard]] bool checkSphere(const Vector3&, float) const;
32
33 enum class Intersect
34 {
38 };
39 //Intersect checkBox(const AABB& box) const;
40 //bool checkBoxFast(const AABB& box) const;
41
42 [[nodiscard]] const Vector4& getNearPlane() const { return planes[0]; };
43 [[nodiscard]] const Vector4& getFarPlane() const { return planes[1]; };
44 [[nodiscard]] const Vector4& getLeftPlane() const { return planes[2]; };
45 [[nodiscard]] const Vector4& getRightPlane() const { return planes[3]; };
46 [[nodiscard]] const Vector4& getTopPlane() const { return planes[4]; };
47 [[nodiscard]] const Vector4& getBottomPlane() const { return planes[5]; };
48 };
49}
const Vector4 & getNearPlane() const
Definition primitives.h:42
bool checkPoint(const Vector3 &) const
const Vector4 & getRightPlane() const
Definition primitives.h:45
bool checkSphere(const Vector3 &, float) const
const Vector4 & getFarPlane() const
Definition primitives.h:43
const Vector4 & getTopPlane() const
Definition primitives.h:46
const Vector4 & getBottomPlane() const
Definition primitives.h:47
const Vector4 & getLeftPlane() const
Definition primitives.h:44
void create(const Matrix4 &viewProjection)
4x4 column-major transformation matrix with SIMD acceleration.
Definition matrix4.h:31
3D vector for positions, directions, and normals with multi-backend SIMD acceleration.
Definition vector3.h:29
4D vector for homogeneous coordinates, color values, and SIMD operations.
Definition vector4.h:20