"Sqriancle" as a "view dependent model" (and a better shape for candy)

In their article “Generation of view dependent models using free form deformation”, Guy & Sela Gershon Elber coined the term “sqriancle”(SQuare, tRIANgle and cirCLE) as an object that looks like a square, a triangle or a circle when observed from different angles.
A picture of the same object appeared in “Advances in Architectural Geometry 2010” edited by Cristiano Ceccato et al.

Let us see what this “view dependent object” looks like in Mathematica. Here is a ring-like object that could form the base of our sqriancle as it appears as a square, triangle or circle depending on the viewpoint.

Grid[{Style[#, Bold] & /@ {"Default", "Side", "Top", "Front"}, 
  Graphics3D[{{FaceForm[], EdgeForm[{AbsoluteThickness[4], Blue}], 
       Cylinder[{{0, 0, 0}, {0, 0, .01}} 1]}, {Blue, 
       AbsoluteThickness[4], Line[{{0, 1, 0}, {0, 0, 2}, {0, -1, 0}}],
        Line[{{-1, 0, 2}, {1, 0, 2}}], Line[{{1, 0, 0}, {1, 0, 2}}], 
       Line[{{-1, 0, 0}, {-1, 0, 2}}]}}, Boxed -> False, 
     ViewPoint -> #] & /@ {{30, 35, 25}, {50, 1, 0}, {0, 0, 
     50}, {0, -50, 0}}}]

This shows the geometry of a sqriancle consisting of a unit circle, a unit square perpendicular to it along the diameter and a perpendicular triangle SQR with height h straddling the circle. A point P is on the contour of the triangle.

To create a volume with the 3 different views, we take the base SR of the triangle as a chord in the circle and thus dependent on x. A point P{x,y,z) on the boundary of the triangular cross section RSQ has the following coordinates:

2630formula1.png

To compute the parametric surface, we convert the coordinates of P to polar form:

{x, y, (h (Sqrt[1 - x^2] - Abs[y]))/Sqrt[
    1 - x^2]} /. {x -> r Cos[phi], y -> r Sin[phi]} // 
  Simplify // Rasterize

7552formula2.png

This is a function for the parametric coordinates of a point P on the sqriancle: r and phi are the polar coordinates of the projection of P in the x-y plane:

sqriancle[r_, phi_, 
  h_ : 2] := {{r Cos[phi], r Sin[phi], 0.}, {r Cos[phi], r Sin[phi], 
   h - (h Abs[r Sin[phi]])/Sqrt[1 - r^2 Cos[phi]^2]}}
Animate[ParametricPlot3D[
  sqriancle[r, phi], {phi, -Pi, 2 Pi}, {r, 0, 1}, 
  RegionFunction -> Function[x, x <= csx], 
  BoundaryStyle -> Directive[Red, Thick], 
  PlotStyle -> Lighter[Gray, .5], MeshFunctions -> {#1 &, #3 &}, 
  Mesh -> {{-.3, -.6, -.9, .9999, 0, .3, .6, .9}, 10}, 
  MeshStyle -> AbsoluteThickness[1], Boxed -> False, 
  Axes -> False], {csx, 1., -1.}]

animocrosscuts.gif

Here is how our sqriancle looks like if observed from viewpoints along the x-, y- and z-axes:

Grid[{Style[#, Bold] & /@ {"Default", "Side", "Top", "Front"}, 
  With[{h = 2.}, 
   ParametricPlot3D[sqriancle[r, phi], {phi, 0., 2 Pi}, {r, 0, 1}, 
      PlotPoints -> 25, PlotStyle -> Lighter[Yellow, .25], 
      MeshFunctions -> {#1 &, #3 &}, 
      Mesh -> {{-.3, -.6, -.9, .9999, 0, .3, .6, .9}, 10}, 
      MeshStyle -> AbsoluteThickness[1], Boxed -> False, 
      Axes -> False, ViewPoint -> #] & /@ {{35, 35, 35}, {50, 1, 
      0}, {0, 0, 50}, {0, -50, 1}}]

We can check that the sqriancle volume fits between a triangular prism and a cone:

Module[{co, sq, pr},
 co = Cone[{{0, 0, 0}, {0, 0, 2}}, .985];
 sq = First@
   ParametricPlot3D[sqriancle[r, phi], {phi, 0., 2 Pi}, {r, 0, 1.}, 
    PlotPoints -> 50, MeshFunctions -> {#3 &}];
 pr = Prism[{{-1, 0, 2}, {-1, 1, 0}, {-1, -1, 0},    {1., 0, 2}, {1., 
     1, 0}, {1., -1, 0}}];
 Row[{Graphics3D[{Opacity[.9], co, {Opacity[.5], sq}, Opacity[.3], 
     pr}, Boxed -> False, Lighting -> "ThreePoint", 
    ImageSize -> 300],
   Grid[{{"cone", "sqriancle", "prism"}, 
     Assuming[{h >= 0, r >= 0, 
       Element[{r, h}, Reals]}, {Volume@
        Cone[{{0, 0, 0}, {0, 0, h}}, r], 
       Integrate[h Sqrt[r^2 - x^2], {x, -r, r}], 
       Volume@
        Prism[{{-r, 0, h}, {-r, r, 0}, {-r, -r, 0},    {r, 0, h}, {r, 
           r, 0}, {r, -r, 0}}]}]}, Frame -> All]}]]

Using Volume on the discretized implicit region using h=2 and r=1, we approach the value above of Pi (3.1372) as the number of cells increases:

With[{h = 2.}, 
  reg = ImplicitRegion[
    0 <= z <= (h (Sqrt[1 - x^2] - Abs[y]))/Sqrt[
     1 - x^2], {{x, -1, 1}, {y, 0, 1}, z}]];
sqr = DiscretizeRegion[reg, AccuracyGoal -> 6, MaxCellMeasure -> .01]
Rasterize[Volume[sqr]]

We can make variations on the sqriancle in 3 ways, by changing the shape of either the circular z-axis cross section or the square or triangular cross sections of the y-and x-axes. We could e.g. use different regular polygons as alternative z-axis cross sections using the parametric. Here are two sets of views with a square bottom with 2 different rotation angles [Alpha] :

poly[t_, t0_, n_] := 
 Cos[Pi/n] Sec[(2 ArcTan[Cot[1/2 n (t - t0)]])/n] {Cos[t], Sin[t]}
ParallelTable[
 Module[{n = 4, sol}, 
  fits = 
   Quiet[
    Table[{t0, FindMaxValue[Last[poly[t, t0, n]], t]}, {t0, 0, 2 Pi, 
      Pi/16}]]; 
  sol[t_] := 
   Normal[
    Quiet[
     First[
      Solve[{x, y, z} \[Element] 
        Line[{{First[poly[t, alpha, n]], 0, 2}, 
          Insert[poly[t, alpha, n], 0., -1]}], {x, y}]]]]; 
  Grid[{(Style[#1, Bold] &) /@ {"Default", "Side", "Top", "Front"}, 
    ParallelMap[
     Graphics3D[{{First[
          ParametricPlot3D[{x, y, z} /. sol[s], {s, 0, 2 Pi}, {z, 0, 
            2}, PlotStyle -> Lighter[Yellow, .25], 
           MeshFunctions -> {#1 &, #3 &}, 
           Mesh -> {{-.3, -.6, -.9, .9999, 0, .3, .6, .9}, 10}, 
           MeshStyle -> AbsoluteThickness[1], 
           PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}]]}, 
        First[
         ParametricPlot3D[
          Insert[poly[phi, alpha, n], 0., -1], {phi, 0, 
           2 Pi}]], {AbsoluteThickness[1]}}, Boxed -> False, 
       PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}, 
       ViewAngle -> 1.5 Degree, Lighting -> "ThreePoint", 
       ViewPoint -> #1] &, {{35, 35, 35}, {50, 1, 0}, {0, 0, 
       50}, {0, -50, 1}}]}, Spacings -> 0]], {alpha, {.52, 1.55}}]

This is the same as above but with pentagonal bottoms rotated at different angles :

We take another look at our original sqriancle: Its shape appears as a triangular prism but it has a 22.5 % smaller volume. if it was used as an innovative shape for candy, it would mean less candy and sugar for the same apparent shape!

candy[col_, alpha_, ax_] := 
 Rotate[First@
   ParametricPlot3D[sqriancle[r, phi], {phi, -.01, 2 Pi}, {r, 0, 1}, 
    PlotPoints -> 50, PlotStyle -> col, Mesh -> False, Boxed -> False,
     Axes -> False], alpha, RotateRight[{0, 0, 1}, ax]]
Module[{c}, c = candy[Red, Pi/4, 2];
 Animate[
  Graphics3D[c, Boxed -> False, 
   ViewVector -> 
    RotationTransform[Pi/4, {1, -1, -1}]@{4 Sin[phi], 4 Cos[phi], 
      8}], {{phi, 0}, 0, 2 Pi}]]

onecandysmall.gif

Here is a box full of it. Bon appetit!

9 Likes

news-congrads-kkluyshnik-02-04-19.jpg – you have earned Featured Contributor Badge 2015-11-02_10-07-11.png
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

Hi, Erik! This really inspired me today. I used your ImplicitRegion equations in a RegionPlot3D to create something that I could export and 3D print. The print came out great! See my initial photos below. I also plan to try to print it twice as big (linearly… which, of course, makes it have 8 times the volume).

With your permission, I would like to post the 3D model on www.cults3d.com where other people will be able to download it. I would post it as a free download and credit you and your article in the item description. As an example of similar items I posted recently, see this link: https://cults3d.com/en/3d-model/various/circle-base-solids.

Thanks for the fun project today!

-Abby

2 Likes

This is a beautiful article with beautiful presentation. I am hoping to learn the tricks for my next posts.

One question: given a 2d view of a sqriancle and some camera model, e.g., orthographic projection, can one derive the 3d view vector?

Dan

1 Like

Glad you enjoyed my contribution and it gave you new inspiration! So did your beautiful website: CIRCLE BASE SOLIDS. Please go ahead and use whatever you need!
Inspired by your colourfully shaded 3D prints, I adapted my “sqriancle” function and changed the square to a parabola and made it a “pariancle” (parabola/triangle/ circle)

ParametricPlot3D[{{r Cos[\[Phi]], r Sin[\[Phi]], 0.}, {r Cos[\[Phi]], 
   r Sin[\[Phi]], -2 (-1 + r^2 Cos[\[Phi]]^2 + 
      Abs[r Sin[\[Phi]]] Sqrt[1 - r^2 Cos[\[Phi]]^2])}}, {\[Phi], 0, 
  2 \[Pi]}, {r, 0, 1}, PlotPoints -> 25, 
 PlotStyle -> Lighter[Yellow, .05], MeshFunctions -> {#1 &, #2 &}, 
 Mesh -> {16, 16}, MeshStyle -> AbsoluteThickness[1], 
 PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}, Boxed -> False, 
 Axes -> False]

To add some color, I changed it to slices:

slice[{y1_, y2_}, col_] := 
 First@ParametricPlot3D[{{r Cos[\[Phi]], r Sin[\[Phi]], 
     0.}, {r Cos[\[Phi]], 
     r Sin[\[Phi]], -2 (-1 + r^2 Cos[\[Phi]]^2 + 
        Abs[r Sin[\[Phi]]] Sqrt[1 - r^2 Cos[\[Phi]]^2])}}, {\[Phi], 0,
     2 \[Pi]}, {r, 0, 1}, Mesh -> None, PlotPoints -> 50, 
   PlotStyle -> col, 
   RegionFunction -> Function[{x, y, z}, y1 <= y <= y2], 
   BoundaryStyle -> AbsoluteThickness[1], 
   PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}, Boxed -> False, 
   Axes -> False]

bounds = Partition[Range[-1, 1, .125], 2, 1];

pariancle = 
 Show[MapThread[Graphics3D[slice[#1, #2]] &, {bounds, colors}], 
  Boxed -> False, Lighting -> "ThreePoint"]

Grid[{Style[#, Bold] & /@ {"default", "Side", "Top", "Front"}, 
  Show[pariancle, PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}, 
     Boxed -> False, Axes -> False, ViewPoint -> #, 
     ViewAngle -> 1.5 \[Degree], 
     Lighting -> "ThreePoint"] & /@ {16 {1.3, -2.4, 2}, {50, 1, 
     0}, {0, 0, 50}, {0, -50, 1}}}, Spacings -> 0]

Wish I had a 3D printer now. Have fun!

2 Likes

In the article I mentioned "Generation of view dependent models using free form deformation the authors use 2D information to make 3D objects. But in my case, I needed all 3 dimensional info (the code for and a circle, and a triangle and a square)
They use 2 views to generate a complete 3D object…and their method is way more universal (and complicated)
Glad you enjoyed my contribution.

1 Like

Thanks! I will add the link here when it is available. Likely it will be a separate post.

1 Like

Hi, Erik! The “Sqriancle” is now available as a free STL file download. It is posted at Cults3D: https://cults3d.com/en/3d-model/various/sqriancle. More photos are on that web page too. Thanks again for the inspiration for this project!

SqriancleTurntableTwitter.gif

2 Likes