ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
TriangleGroupDeformer.h
Go to the documentation of this file.
1/**
2 * @file TriangleGroupDeformer.h
3 * @brief Provides functionality to deform groups of 3D triangles in various ways.
4 *
5 * The TriangleGroupDeformer class allows for applying sinusoidal, dropwave, and other
6 * deformation effects to groups of 3D triangles, with support for axis-aligned clipping.
7 *
8 * @date 22/12/2024
9 * @version 1.0
10 * @author Coela Can't
11 */
12
13#pragma once
14
15#include "TriangleGroup.h"
16
17/**
18 * @class TriangleGroupDeformer
19 * @brief Provides deformation effects for groups of triangles.
20 *
21 * This class supports applying various deformations to groups of triangles
22 * such as sinusoidal, dropwave, and cosine interpolation. It also supports
23 * axis-aligned clipping and custom deformations along selected axes.
24 */
26public:
27 /**
28 * @enum Axis
29 * @brief Defines the axes available for deformations and clipping.
30 */
31 enum Axis {
32 XAxis, ///< X-axis.
33 YAxis, ///< Y-axis.
34 ZAxis ///< Z-axis.
35 };
36
37private:
38 ITriangleGroup** objects; ///< Array of triangle group objects to deform.
39 int objectCount = 0; ///< Number of triangle group objects.
40
41 /**
42 * @brief Checks if a given base position is clipped along a specific axis.
43 * @param base The base position to check.
44 * @param positive Whether to check the positive side of the axis.
45 * @param valueCheckAxis The axis to check against.
46 * @return True if the base position is clipped, otherwise false.
47 */
48 bool CheckClipAxis(Vector3D base, bool positive, Axis valueCheckAxis);
49
50public:
51 /**
52 * @brief Constructor for a single triangle group.
53 * @param object A single triangle group object to deform.
54 */
56
57 /**
58 * @brief Constructor for multiple triangle groups.
59 * @param objects Array of triangle group objects to deform.
60 * @param objectCount Number of triangle group objects.
61 */
63
64 /**
65 * @brief Applies a sinusoidal deformation along a specified axis.
66 * @param magnitude Magnitude of the deformation.
67 * @param timeRatio Time progression ratio for the deformation.
68 * @param periodModifier Modifier for the deformation period.
69 * @param frequencyModifier Modifier for the deformation frequency.
70 * @param axis The axis along which to apply the deformation.
71 */
72 void SinusoidalDeform(float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis);
73
74 /**
75 * @brief Applies a dropwave deformation along a specified axis.
76 * @param magnitude Magnitude of the deformation.
77 * @param timeRatio Time progression ratio for the deformation.
78 * @param periodModifier Modifier for the deformation period.
79 * @param frequencyModifier Modifier for the deformation frequency.
80 * @param axis The axis along which to apply the deformation.
81 */
82 void DropwaveDeform(float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis);
83
84 /**
85 * @brief Applies a sine wave surface deformation along a specified axis.
86 * @param offset Offset for the sine wave deformation.
87 * @param magnitude Magnitude of the deformation.
88 * @param timeRatio Time progression ratio for the deformation.
89 * @param periodModifier Modifier for the deformation period.
90 * @param frequencyModifier Modifier for the deformation frequency.
91 * @param axis The axis along which to apply the deformation.
92 */
93 void SineWaveSurfaceDeform(Vector3D offset, float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis);
94
95 /**
96 * @brief Applies a cosine interpolation deformation along a specified axis.
97 * @param pointMultiplier Array of multipliers for points during deformation.
98 * @param points Number of points to deform.
99 * @param scale Scale of the deformation.
100 * @param minAxis Minimum axis value for deformation.
101 * @param maxAxis Maximum axis value for deformation.
102 * @param selectionAxis Axis used for selecting points.
103 * @param deformAxis Axis along which the deformation is applied.
104 */
105 void CosineInterpolationDeformer(float* pointMultiplier, int points, float scale, float minAxis, float maxAxis, Axis selectionAxis, Axis deformAxis);
106
107 /**
108 * @brief Applies axis-aligned clipping to the triangles.
109 * @param positive Whether to clip along the positive side of the axis.
110 * @param clipAxis Axis to apply the clipping.
111 * @param valueCheckAxis Axis used to determine clipping.
112 */
113 void AxisZeroClipping(bool positive, Axis clipAxis, Axis valueCheckAxis);
114};
Defines the TriangleGroup class for dynamic manipulation of triangles in 3D space.
Interface for managing a dynamic group of 3D triangles and associated data.
Provides deformation effects for groups of triangles.
void DropwaveDeform(float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis)
Applies a dropwave deformation along a specified axis.
void SineWaveSurfaceDeform(Vector3D offset, float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis)
Applies a sine wave surface deformation along a specified axis.
ITriangleGroup ** objects
Array of triangle group objects to deform.
void CosineInterpolationDeformer(float *pointMultiplier, int points, float scale, float minAxis, float maxAxis, Axis selectionAxis, Axis deformAxis)
Applies a cosine interpolation deformation along a specified axis.
void AxisZeroClipping(bool positive, Axis clipAxis, Axis valueCheckAxis)
Applies axis-aligned clipping to the triangles.
bool CheckClipAxis(Vector3D base, bool positive, Axis valueCheckAxis)
Checks if a given base position is clipped along a specific axis.
void SinusoidalDeform(float magnitude, float timeRatio, float periodModifier, float frequencyModifier, Axis axis)
Applies a sinusoidal deformation along a specified axis.
Axis
Defines the axes available for deformations and clipping.
int objectCount
Number of triangle group objects.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26