Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
typed-geometry
Commits
3f362346
Commit
3f362346
authored
Jan 21, 2021
by
Aaron Grabowy
Browse files
Fixed uniform distribution in solid pyramids
parent
0c9b77ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/typed-geometry/functions/random/uniform.hh
View file @
3f362346
...
...
@@ -701,8 +701,9 @@ template <class ScalarT, class Rng>
template
<
class
BaseT
,
class
Rng
>
[[
nodiscard
]]
constexpr
pos
<
3
,
typename
BaseT
::
scalar_t
>
uniform
(
Rng
&
rng
,
pyramid
<
BaseT
>
const
&
p
)
{
using
ScalarT
=
typename
BaseT
::
scalar_t
;
const
auto
n
=
normal_of
(
p
.
base
);
const
auto
h
=
pow2
(
detail
::
uniform01
<
typename
BaseT
::
s
calar
_t
>
(
rng
));
const
auto
h
=
ScalarT
(
1
)
-
cbrt
(
detail
::
uniform01
<
S
calar
T
>
(
rng
));
const
auto
pBase
=
uniform
(
rng
,
p
.
base
);
return
mix
(
pBase
,
centroid_of
(
p
.
base
),
h
)
+
h
*
p
.
height
*
n
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment