AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
HeightMapGenerator.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXMODEL_HEIGHT_MAP_GENERATOR_H
18#define AGXMODEL_HEIGHT_MAP_GENERATOR_H
19
20#include <agxModel/export.h>
21#include <agx/Referenced.h>
22#include <agx/Real.h>
23#include <agx/Vector.h>
25#include <agxIO/Image.h>
27
28
29namespace agx
30{
32}
33
34
35namespace agxCollide
36{
37 class Trimesh;
38}
39
40namespace agxModel
41{
46 {
47 public:
48
50 HeightMapGenerator(const size_t& width, const size_t& height);
51
55 size_t getWidth();
56
60 void setWidth(const size_t& width);
61
65 size_t getHeight();
66
70 void setHeigth(const size_t& height);
71
72 protected:
73
76
77 protected:
78 size_t m_width;
79 size_t m_height;
80 };
81
83
88 {
89 public:
90 GaussianFunctionSettings(const agx::Vec2& size, const agx::Vec2& widthInter,
91 const agx::Vec2& heightInter, size_t num, bool periodic_x = false, bool periodic_y = false, agx::Real max_Height = 0);
92
94
95 agx::Vec2 areaSize; // Specifying the area size that will be mapped to the height texture
96 agx::Vec2 widthInterval; // Specifying the width interval where bumps will be present
97 agx::Vec2 heightInterval; // Specifying the height interval where bumps will be present
98 size_t numDimples; // Specifying the number of Gaussian bumps that is used in the texture
99 bool periodic_X; // True if the bumps should be periodic along the x-axis
100 bool periodic_Y; // True if the bumps should be periodic along the Y-axis
101 agx::Real maxHeight; // Max height of any point in the height texture
102 };
103
106 {
107
108 public:
109
112
116 GaussianHeightMapGenerator(const size_t& width, const size_t& height,
117 const GaussianFunctionSettings& settings);
118
123
128
132 void setSeed(agx::UInt seed);
133
138
139 protected:
140
141 void init();
142
145
148 agx::Vec2 Y_bounds, size_t Y_resolution,
149 const agx::RealMatrix& pos, const agx::RealMatrix& spread, const agx::RealVector& amplitude,
150 bool limitToMaxHeight=false, agx::Real maxHeight=0);
151
152 protected:
153
156 };
157
158 /*Implementation*/
159
161 {
162 return m_width;
163 }
164
169
174
178 namespace MeshModifierUtils
179 {
181 agxCollide::Trimesh *trimesh,
182 agx::RealMatrix *heightData,
183 agx::Vec3 axis,
184 agx::Vec3 perpendicularBaseVector,
185 agx::Real cylinderLength,
186 agx::Vec3 cylinderCenter);
187 }
188}
189
190#endif /*AGXMODEL_HEIGHT_MAP_GENERATOR_H*/
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXMODEL_EXPORT
Triangle mesh for geometric intersection tests.
Definition Trimesh.h:43
This struct holds parameters for the creation of a height texture that is a composite bump created by...
GaussianFunctionSettings(const agx::Vec2 &size, const agx::Vec2 &widthInter, const agx::Vec2 &heightInter, size_t num, bool periodic_x=false, bool periodic_y=false, agx::Real max_Height=0)
A height map generator using a Gaussian function.
virtual ~GaussianHeightMapGenerator()
Default destructor.
GaussianFunctionSettings getSettings()
Gets the settings used in the simulation.
GaussianHeightMapGenerator()
Default constructor.
agx::RealMatrix generateHeightData()
Generates and returns height data in matrix form.
agx::RealMatrix createGaussianHeightMatrix(agx::Vec2 X_bounds, size_t X_resolution, agx::Vec2 Y_bounds, size_t Y_resolution, const agx::RealMatrix &pos, const agx::RealMatrix &spread, const agx::RealVector &amplitude, bool limitToMaxHeight=false, agx::Real maxHeight=0)
Creates a matrix that holds the heights of the Gaussian dimples.
void setSettings(const GaussianFunctionSettings &settings)
Sets the settings that will be used when creating the Gaussian texture.
GaussianHeightMapGenerator(const size_t &width, const size_t &height, const GaussianFunctionSettings &settings)
Constructor that takes the image width, image hegiht and settings as arguments.
void setSeed(agx::UInt seed)
Sets the seed that it used by the random number generator when creating a bump texture.
A base class used for generating textures.
virtual ~HeightMapGenerator()
Default destructor.
void setWidth(const size_t &width)
Sets the height in pixels of the produced texture.
void setHeigth(const size_t &height)
Sets the height in pixels of the produced texture.
HeightMapGenerator(const size_t &width, const size_t &height)
size_t getHeight()
Gets the height in pixels of the produced texture.
size_t getWidth()
Gets the width in pixels of the produced texture.
Base class providing referencing counted objects.
Definition Referenced.h:120
Templated vector class.
Definition agx/Vector.h:53
#define AGX_FORCE_INLINE
Definition macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
AGXMODEL_EXPORT agxCollide::Trimesh * bumpCylindricalMeshAroundAnAxisFromHeightData(agxCollide::Trimesh *trimesh, agx::RealMatrix *heightData, agx::Vec3 axis, agx::Vec3 perpendicularBaseVector, agx::Real cylinderLength, agx::Vec3 cylinderCenter)
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
agx::Vector< agx::RealVector > RealMatrix