Skip to content

Commit b3e205f

Browse files
committed
Add Boy's surface
1 parent fca7c6a commit b3e205f

7 files changed

Lines changed: 40 additions & 9 deletions

File tree

art/original/thumbs/sextic/boy.png

152 KB
Loading

public/impvis.data

9.89 KB
Binary file not shown.

public/impvis.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/impvis.wasm

113 Bytes
Binary file not shown.

src/assets/functions/04_sextic.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,36 @@ expression = '''
2020
4*(phi^2*x^2-y^2)*(phi^2*y^2-z^2)*(phi^2*z^2-x^2)
2121
-(1+2*phi)*(x^2+y^2+z^2-w^2)^2*w^2'''
2222

23+
[boy]
24+
name = "Boy"
25+
thumbnail = "textures/thumbs/sextic/boy.png"
26+
bounds_radius = 4.8
27+
isosurface_raymarch_method = "fixed-step"
28+
isosurface_raymarch_steps = 500
29+
scale = 0.7
30+
dvr_raymarch_steps = 400
31+
dvr_falloff = 0.001
32+
gaussian_curvature_falloff = 0.1
33+
mean_curvature_falloff = 0.15
34+
max_abs_curvature_falloff = 0.05
35+
normal_length_falloff = 0.005
36+
code_local = '''
37+
float x_0=1.0;
38+
float x_1=x;
39+
float x_2=y;
40+
float x_3=z;
41+
'''
42+
comment = '''
43+
\mathrm{where}\\
44+
&\quad x_0=1,\\
45+
&\quad x_1=x,\\
46+
&\quad x_2=y,\\
47+
&\quad x_3=z.'''
48+
expression = '''
49+
64*(x_0-x_3)^3*x_3^3-48*(x_0-x_3)^2*x_3^2*(3*x_1^2+3*x_2^2+2*x_3^2)
50+
+12*(x_0-x_3)*x_3*[27*(x_1^2+x_2^2)^2-24*x_3^2*(x_1^2+x_2^2)+36*sqrt(2)*x_2*x_3*(x_2^2-3*x_1^2)+x_3^4]
51+
+(9*x_1^2+9*x_2^2-2*x_3^2)*[-81*(x_1^2+x_2^2)^2-71*x_3^2*(x_1^2+x_2^2)+108*sqrt(2)*x_1*x_3*(x_1^2-3*x_2^2)+4*x_3^4]'''
52+
2353
[chmutov_sextic]
2454
name = "Chmutov Sextic"
2555
thumbnail = "textures/thumbs/sextic/chmutov_sextic.png"
9.09 KB
Loading

src/util.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,26 @@ concept ReplaceCallback =
2727
std::size_t replaceAllAndInvoke(std::string &inout, std::string_view what,
2828
std::string_view with,
2929
ReplaceCallback auto &&replaceCallback,
30-
bool matchWholeWord = false) {
30+
bool matchIdentifier = false) {
3131
if (what.empty()) {
3232
return 0;
3333
}
3434

35-
auto const isAlpha{
36-
[](char c) { return std::isalpha(static_cast<unsigned char>(c)); }};
35+
auto const isIdentifier{[](char c) {
36+
return std::isalnum(static_cast<unsigned char>(c)) || c == '_';
37+
}};
3738

3839
std::size_t count{};
3940
for (auto pos{inout.find(what)}; pos != std::string::npos;
4041
pos = inout.find(what, pos)) {
4142

42-
if (matchWholeWord) {
43+
if (matchIdentifier) {
4344
auto const posFirstChar{pos};
4445
auto const posLastChar{pos + what.length() - 1};
4546
auto const wholeWord{
46-
(posFirstChar == 0 || !isAlpha(inout.at(posFirstChar - 1))) &&
47+
(posFirstChar == 0 || !isIdentifier(inout.at(posFirstChar - 1))) &&
4748
(posLastChar >= inout.size() - 1 ||
48-
!isAlpha(inout.at(posLastChar + 1)))};
49+
!isIdentifier(inout.at(posLastChar + 1)))};
4950
if (!wholeWord) {
5051
++pos;
5152
continue;
@@ -68,9 +69,9 @@ std::size_t replaceAllAndInvoke(std::string &inout, std::string_view what,
6869
// 'with'.
6970
inline std::size_t replaceAll(std::string &inout, std::string_view what,
7071
std::string_view with,
71-
bool matchWholeWord = false) {
72+
bool matchIdentifier = false) {
7273
return replaceAllAndInvoke(
73-
inout, what, with, [](auto &, auto) {}, matchWholeWord);
74+
inout, what, with, [](auto &, auto) {}, matchIdentifier);
7475
}
7576

7677
// Converts a string_view to a lowercase std::string (ASCII only).

0 commit comments

Comments
 (0)