HighMap library (C++)
Loading...
Searching...
No Matches
sdf.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
12#pragma once
13
14#include "highmap/array.hpp"
16
17namespace hmap
18{
19
47Array sdf_2d_polyline(const Path &path,
48 glm::ivec2 shape,
49 const UvRect &uv_rect = UvRect::unit(),
50 const Array *p_noise_x = nullptr,
51 const Array *p_noise_y = nullptr,
52 bool use_bvh = true);
53
55 glm::ivec2 shape,
56 const UvRect &uv_rect = UvRect::unit(),
57 const Array *p_noise_x = nullptr,
58 const Array *p_noise_y = nullptr);
59
61 glm::ivec2 shape,
62 const UvRect &uv_rect = UvRect::unit(),
63 const Array *p_noise_x = nullptr,
64 const Array *p_noise_y = nullptr);
65
69 glm::ivec2 shape,
70 const UvRect &uv_rect = UvRect::unit(),
71 const Array *p_noise_x = nullptr,
72 const Array *p_noise_y = nullptr,
73 bool use_bvh = true);
74
76 glm::ivec2 shape,
77 const UvRect &uv_rect = UvRect::unit(),
78 const Array *p_noise_x = nullptr,
79 const Array *p_noise_y = nullptr);
80
82 glm::ivec2 shape,
83 const UvRect &uv_rect = UvRect::unit(),
84 const Array *p_noise_x = nullptr,
85 const Array *p_noise_y = nullptr);
86
104Array sdf_2d_graph(const Graph &graph,
105 glm::ivec2 shape,
106 const UvRect &uv_rect = UvRect::unit(),
107 const Array *p_noise_x = nullptr,
108 const Array *p_noise_y = nullptr,
109 bool use_bvh = true);
110
112 glm::ivec2 shape,
113 const UvRect &uv_rect = UvRect::unit(),
114 const Array *p_noise_x = nullptr,
115 const Array *p_noise_y = nullptr);
116
117Array sdf_2d_graph_bvh(const Graph &graph,
118 glm::ivec2 shape,
119 const UvRect &uv_rect = UvRect::unit(),
120 const Array *p_noise_x = nullptr,
121 const Array *p_noise_y = nullptr);
122
123} // namespace hmap
124
125namespace hmap::gpu
126{
127
129Array sdf_2d_polyline(const Path &path,
130 glm::ivec2 shape,
131 const UvRect &uv_rect = UvRect::unit(),
132 const Array *p_noise_x = nullptr,
133 const Array *p_noise_y = nullptr);
134
136Array sdf_2d_polyline_bezier(const Path &path,
137 glm::ivec2 shape,
138 const UvRect &uv_rect = UvRect::unit(),
139 const Array *p_noise_x = nullptr,
140 const Array *p_noise_y = nullptr);
141
142} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:31
Graph class, to manipulate graphs in 2D.
Definition graph.hpp:70
Represents an ordered set of points in 2D, forming a polyline (open or closed).
Definition path.hpp:43
Definition array_blending.hpp:225
Array sdf_2d_polyline(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
See hmap::sdf_2d_polyline.
Definition sdf_2d_polyline_gpu.cpp:20
Array sdf_2d_polyline_bezier(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
See hmap::sdf_2d_polyline_bezier.
Definition sdf_2d_polyline_gpu.cpp:84
Definition opencv.hpp:20
Array sdf_2d_polyline_bezier(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, bool use_bvh=true)
See hmap::sdf_2d_polyline, with a Bezier approximation of the path.
Definition sdf_2d_polyline_bezier.cpp:367
Array sdf_2d_polyline_bezier_brute_force(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_polyline_bezier.cpp:388
Array sdf_2d_graph_bvh(const Graph &graph, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_graph.cpp:161
Array sdf_2d_polyline(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, bool use_bvh=true)
Computes the signed distance field (SDF) of a 2D polyline.
Definition sdf_2d_polyline.cpp:95
Array sdf_2d_graph_brute_force(const Graph &graph, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_graph.cpp:107
Array sdf_2d_graph(const Graph &graph, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, bool use_bvh=true)
Computes the 2D unsigned distance field to a graph network.
Definition sdf_2d_graph.cpp:94
Array sdf_2d_polyline_brute_force(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_polyline.cpp:112
Array sdf_2d_polyline_bvh(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_polyline.cpp:167
Array sdf_2d_polyline_bezier_bvh(const Path &path, glm::ivec2 shape, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
Definition sdf_2d_polyline_bezier.cpp:445
Path class for manipulating and analyzing paths in 2D space.
Axis-aligned rectangle in normalized [0, 1]^2 domain/UV space.
Definition uv_rect.hpp:30
static constexpr UvRect unit()
Definition uv_rect.hpp:46