Browse Source

Minor bugfix and more examples

main
raffitz 4 years ago
parent
commit
00c1d38b03
Signed by: raffitz
GPG Key ID: BB3596BD0A31252D
  1. 14
      examples/helix1.solid
  2. 6
      examples/ramp.solid
  3. 16
      examples/rotating_triangle_torus.solid
  4. 16
      examples/rotating_triangle_torus2.solid
  5. 16
      examples/rotating_triangle_torus3.solid
  6. 16
      examples/rotating_triangle_torus4.solid
  7. 2
      src/main.rs

14
examples/helix1.solid

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
# Helix with radius s, inner radius 2s
define @b (3 * s) / 2
define @a @b / π
-5*s <= x <= 5*s
-5*s <= y <= 5*s
-s <= z <= 2*s
(ρ - 3*s)^2 + (z - @b - (@a * φ))^2 <= s^2 \
∨ \
(ρ - 3*s)^2 + (z - 3*s - @b - (@a * φ))^2 <= s^2 \
∨ \
(ρ - 3*s)^2 + (z + 3*s - @b - (@a * φ))^2 <= s^2

6
examples/ramp.solid

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
-10<x<10
-10<y<10
-10*pi<z<10*pi
z < 10*φ

16
examples/rotating_triangle_torus.solid

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Rotating triangle torus
define @angle0 φ
define @angle1 φ + ⅓π
define @angle2 φ + 2 * ⅓π
define @angle3 φ + π
define @angle4 φ + π + ⅓π
define @angle5 φ + 2π - ⅓π
-5 * s < x < 5 * s
-5 * s < y < 5 * s
-s < z < s
(ρ - (3 * s) - s * (cos @angle0)) * (cos @angle1) + (z - s * (sin @angle0)) * (sin @angle1) < 0
(ρ - (3 * s) - s * (cos @angle2)) * (cos @angle3) + (z - s * (sin @angle2)) * (sin @angle3) < 0
(ρ - (3 * s) - s * (cos @angle4)) * (cos @angle5) + (z - s * (sin @angle4)) * (sin @angle5) < 0

16
examples/rotating_triangle_torus2.solid

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Rotating triangle torus
define @angle0 2 * φ
define @angle1 2 * φ + ⅓π
define @angle2 2 * φ + 2 * ⅓π
define @angle3 2 * φ + π
define @angle4 2 * φ + π + ⅓π
define @angle5 2 * φ + 2π - ⅓π
-5 * s < x < 5 * s
-5 * s < y < 5 * s
- s < z < s
(ρ - (3 * s) - s * (cos @angle0)) * (cos @angle1) + (z - s * (sin @angle0)) * (sin @angle1) < 0
(ρ - (3 * s) - s * (cos @angle2)) * (cos @angle3) + (z - s * (sin @angle2)) * (sin @angle3) < 0
(ρ - (3 * s) - s * (cos @angle4)) * (cos @angle5) + (z - s * (sin @angle4)) * (sin @angle5) < 0

16
examples/rotating_triangle_torus3.solid

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Rotating triangle torus
define @angle0 (1/3) * φ
define @angle1 (1/3) * φ + ⅓π
define @angle2 (1/3) * φ + 2 * ⅓π
define @angle3 (1/3) * φ + π
define @angle4 (1/3) * φ + π + ⅓π
define @angle5 (1/3) * φ + 2π - ⅓π
5 * s < x < 5 * s
5 * s < y < 5 * s
- s < z < s
(ρ - (3 * s) - s * (cos @angle0)) * (cos @angle1) + (z - s * (sin @angle0)) * (sin @angle1) < 0
(ρ - (3 * s) - s * (cos @angle2)) * (cos @angle3) + (z - s * (sin @angle2)) * (sin @angle3) < 0
(ρ - (3 * s) - s * (cos @angle4)) * (cos @angle5) + (z - s * (sin @angle4)) * (sin @angle5) < 0

16
examples/rotating_triangle_torus4.solid

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Rotating triangle torus
define @angle0 (2/3) * φ
define @angle1 (2/3) * φ + ⅓π
define @angle2 (2/3) * φ + 2 * ⅓π
define @angle3 (2/3) * φ + π
define @angle4 (2/3) * φ + π + ⅓π
define @angle5 (2/3) * φ + 2π - ⅓π
-5 * s < x < 5 * s
-5 * s < y < 5 * s
-s < z < s
(ρ - (3 * s) - s * (cos @angle0)) * (cos @angle1) + (z - s * (sin @angle0)) * (sin @angle1) < 0
(ρ - (3 * s) - s * (cos @angle2)) * (cos @angle3) + (z - s * (sin @angle2)) * (sin @angle3) < 0
(ρ - (3 * s) - s * (cos @angle4)) * (cos @angle5) + (z - s * (sin @angle4)) * (sin @angle5) < 0

2
src/main.rs

@ -163,7 +163,7 @@ pomelo! { @@ -163,7 +163,7 @@ pomelo! {
%type #[regex(r"\n+")] LineEnd;
%type #[regex("\\\\n", logos::skip)]
%type #[regex(r"\\\n", logos::skip)]
#[regex("#.*\\n", logos::skip)]
#[regex("//.*\\n", logos::skip)]
#[regex(r"[ \t\f]+", logos::skip)]

Loading…
Cancel
Save