File:Hyperboloid ruled surface animation v1.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Hyperboloid_ruled_surface_animation_v1.gif(370 × 470 pixels, file size: 9.88 MB, MIME type: image/gif, looped, 181 frames, 16 s)

Captions

Captions

An illustration of the the generation of a hyperboloid of revolution as the surface of revolution of a slanted line, also featuring all possible angles at which the line can be slanted to create a unique hyperboloid

Summary

[edit]
 
This diagram was created with Mathematica.
Description
English: An illustration of the the generation of a hyperboloid of revolution as the surface of revolution of a slanted line, also featuring all possible angles at which the line can be slanted to create a unique hyperboloid (thus including its two degenerate forms - a cone and an open cylinder). This is a prototype, and thus likely not the final form of this animation
Date
Source Own work
Author Lemondoge
Other versions
Source code
InfoField

Mathematica code

(* config *)
frames = 60;  (*frame count for first generation loop *)
offset = -Pi + 0.8; (* ensure favorable "alignment" *)
(* From the Mathematica stack exchange: 
https://mathematica.stackexchange.com/questions/10957/an-efficient-circular-arc-primitive-for-graphics3d; 
function by user Sjoerd C.de Vries; CC BY-SA *)
splineCircle[m_List, r_, angles_List : {0, 2 \[Pi]}] := 
 Module[{seg, \[Phi], start, end, pts, w, k}, {start, end} = 
    Mod[angles // N, 2 \[Pi]];
   If[end <= start, end += 2 \[Pi]];
   seg = Quotient[end - start // N, \[Pi]/2];
   \[Phi] = Mod[end - start // N, \[Pi]/2];
   If[seg == 4, seg = 3; \[Phi] = \[Pi]/2];
   pts = 
    r RotationMatrix[start] . # & /@ 
     Join[Take[{{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 
         0}, {-1, -1}, {0, -1}}, 2 seg + 1], 
      RotationMatrix[seg \[Pi]/2] . # & /@ {{1, 
         Tan[\[Phi]/2]}, {Cos[\[Phi]], Sin[\[Phi]]}}];
   If[Length[m] == 2, pts = m + # & /@ pts, 
    pts = m + # & /@ 
      Transpose[
       Append[Transpose[pts], ConstantArray[0, Length[pts]]]]];
   w = Join[
     Take[{1, 1/Sqrt[2], 1, 1/Sqrt[2], 1, 1/Sqrt[2], 1}, 
      2 seg + 1], {Cos[\[Phi]/2], 1}];
   k = Join[{0, 0, 0}, Riffle[#, #] &@Range[seg + 1], {seg + 1}];
   BSplineCurve[pts, SplineDegree -> 2, SplineKnots -> k, 
    SplineWeights -> w]] /; Length[m] == 2 || Length[m] == 3

k[a_, b_, t_] := a + (b - a)*t^3
f[u_, v_, 
  skew_ : 2 Pi/3] := {Cos[u + offset], Sin[u + offset], 
    1} (v) + {Cos[u + skew + offset], 
    Sin[u + skew + offset], -1} (1 - v)

borderWidth = -BorderDimensions[
     ParametricPlot3D[f[u, v, 2 Pi/3], {u, 0, 2 Pi}, {v, 0, 1}, 
      PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, Axes -> False, 
      Boxed -> False, ViewPoint -> {1.3, -3, 2}]] + 2;
(*generate table*)
hyperbList = 
  Table[ImagePad[Module[{p = 3 (j/frames)^2 - 2 (j/frames)^3},
     Show[
      ParametricPlot3D[f[u, v], {u, 0, p*2 Pi}, {v, 0, 1}, 
       ColorFunction -> 
        Function[{x, y, z, u}, 
         RGBColor[k[0.880722, 0, u*p], 0.611041, k[0.142051, 1, u*p], 
          1 - (u*p)^3]], Boxed -> False, Axes -> False, 
       ViewPoint -> {1.3, -3, 2}, 
       PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
       PlotPoints -> Ceiling[125 j/frames + 2],
       MeshFunctions -> {#5 &}],
      Graphics3D[{
        (* custom-bake the v mesh, and add other thingamabobbers *)
        GrayLevel[0.2],
        Table[
         Line[{f[2 Pi/16*i, 0], f[2 Pi/16*i, 1]}], {i, 1, 
          Floor[p*16]}],
        Thick, Blue,
        splineCircle[{0, 0 , 1}, 1],
        splineCircle[{0, 0, -1}, 1],
        Black,
        Line[{f[0, 0], f[0, 1]}],
        Line[{f[p*2 Pi, 0], f[p * 2 Pi, 1]}],
        PointSize[0.03],
        Point[{f[0, 0], f[0, 1]}],
        Point[{f[p*2 Pi, 0], f[p * 2 Pi, 1]}],
        GrayLevel[0.2],
        Line[{f[p*2 Pi, 1], {0, 0, 
           1}, {Cos[p*2 Pi + offset + 2 Pi/3], 
           Sin[p*2 Pi + offset + 2 Pi/3], 1}, f[p*2 Pi, 0]}],
        splineCircle[{0, 0, 1}, 
         1/4, {p*2 Pi + offset, p*2 Pi + offset + 2 Pi/3}],
        Line[{{0, 1, -1}, {0, -1, -1}}],
        Line[{{1, 0, -1}, {-1, 0, -1}}],
        Line[{{0, 0, 1}, {0, 0, -1}}]
        }]
      ]
     ], borderWidth], {j, 1, frames}];
(* add frame of u = 0 manually *)
PrependTo[hyperbList, ImagePad[Graphics3D[
    {Thick, Blue,
     splineCircle[{0, 0 , 1}, 1],
     splineCircle[{0, 0, -1}, 1],
     Black,
     Line[{f[0, 0], f[0, 1]}],
     PointSize[0.03],
     Point[{f[0, 0], f[0, 1]}],
     GrayLevel[0.2],
     Line[{f[0, 1], {0, 0, 1}, {Cos[offset + 2 Pi/3], 
        Sin[offset + 2 Pi/3], 1}, f[0, 0]}],
     splineCircle[{0, 0, 1}, 1/4, {offset, offset + 2 Pi/3}],
     Line[{{0, 1, -1}, {0, -1, -1}}],
     Line[{{1, 0, -1}, {-1, 0, -1}}],
     Line[{{0, 0, 1}, {0, 0, -1}}]
     },
    Boxed -> False, Axes -> False, 
    PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
    ViewPoint -> {1.3, -3, 2}],
   borderWidth]];
(* Show transition into cone *)
frames2 = 60;
AppendTo[hyperbList, 
  Splice @Table[
    ImagePad[Module[{p = 3 (j/frames2)^2 - 2 (j/frames2)^3},
      Show[
       ParametricPlot3D[
        f[u, v, (2 + p) Pi/3], {u, 0, 2 Pi}, {v, 0, 1}, 
        ColorFunction -> 
         Function[{x, y, z, u}, 
          RGBColor[k[0.880722, 0, u], 0.611041, k[0.142051, 1, u], 
           1 - (u)^3]], Boxed -> False, Axes -> False, 
        ViewPoint -> {1.3, -3, 2}, 
        PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},
        PlotPoints -> 127,
        MeshFunctions -> {#5 &}],
       Graphics3D[{
         (* custom-bake the v mesh, and add other thingamabobbers *)
         GrayLevel[0.2],
         
         Table[Line[{f[2 Pi/16*i, 0, (2 + p) Pi/3], 
            f[2 Pi/16*i, 1, (2 + p) Pi/3]}], {i, 1, 16}],
         Thick, Blue,
         splineCircle[{0, 0 , 1}, 1],
         splineCircle[{0, 0, -1}, 1],
         
         Line[{f[2 Pi, 1, (2 + p) Pi/3], {0, 0, 
            1}, {Cos[offset + (2 + p) Pi/3], 
            Sin[offset + (2 + p) Pi/3], 1}, f[2 Pi, 0, (2 + p) Pi/3]}],
         
         splineCircle[{0, 0, 1}, 
          1/4, {2 Pi + offset, 2 Pi + offset + (2 + p) Pi/3}],
         Black,
         Line[{f[0, 0, (2 + p) Pi/3], f[0, 1, (2 + p) Pi/3]}],
         Line[{f[2 Pi, 0, (2 + p) Pi/3], f[2 Pi, 1, (2 + p) Pi/3]}],
         PointSize[0.03],
         Point[{f[0, 0, (2 + p) Pi/3], f[0, 1, (2 + p) Pi/3]}],
         Black,
         Point[{f[2 Pi, 0, (2 + p) Pi/3], f[2 Pi, 1, (2 + p) Pi/3]}],
         GrayLevel[0.2],
         Line[{{0, 1, -1}, {0, -1, -1}}],
         Line[{{1, 0, -1}, {-1, 0, -1}}],
         Line[{{0, 0, 1}, {0, 0, -1}}]
         }]
       ]
      ], borderWidth], {j, 1, frames2}]];
(* Show transition to cylinder *)
frames3 = 60;
AppendTo[hyperbList, 
  Splice @Table[
    ImagePad[Module[{p = 3 (j/frames3)^2 - 2 (j/frames3)^3},
      Show[
       ParametricPlot3D[
        f[u, v, (3 - 3 p) Pi/3], {u, 0, 2 Pi}, {v, 0, 1}, 
        ColorFunction -> 
         Function[{x, y, z, u}, 
          RGBColor[k[0.880722, 0, u], 0.611041, k[0.142051, 1, u], 
           1 - (u)^3]], Boxed -> False, Axes -> False, 
        ViewPoint -> {1.3, -3, 2}, 
        PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},
        PlotPoints -> 127,
        MeshFunctions -> {#5 &}],
       Graphics3D[{
         (* custom-bake the v mesh, and add other thingamabobbers *)
         GrayLevel[0.2],
         
         Table[Line[{f[2 Pi/16*i, 0, (3 - 3 p) Pi/3], 
            f[2 Pi/16*i, 1, (3 - 3 p) Pi/3]}], {i, 1, 16}],
         Thick, Blue,
         splineCircle[{0, 0 , 1}, 1],
         splineCircle[{0, 0, -1}, 1],
         
         Line[{f[2 Pi, 1, (3 - 3 p) Pi/3], {0, 0, 
            1}, {Cos[offset + (3 - 3 p) Pi/3], 
            Sin[offset + (3 - 3 p) Pi/3], 1}, 
           f[2 Pi, 0, (3 - 3 p) Pi/3]}],
         
         splineCircle[{0, 0, 1}, 
          1/4, {offset, offset + (3 - 3 p) Pi/3}],
         Black,
         Line[{f[0, 0, (3 - 3 p) Pi/3], f[0, 1, (3 - 3 p) Pi/3]}],
         
         Line[{f[2 Pi, 0, (3 - 3 p) Pi/3], 
           f[2 Pi, 1, (3 - 3 p) Pi/3]}],
         PointSize[0.03],
         Point[{f[0, 0, (3 - 3 p) Pi/3], f[0, 1, (3 - 3 p) Pi/3]}],
         Black,
         
         Point[{f[2 Pi, 0, (3 - 3 p) Pi/3], 
           f[2 Pi, 1, (3 - 3 p) Pi/3]}],
         GrayLevel[0.2],
         Line[{{0, 1, -1}, {0, -1, -1}}],
         Line[{{1, 0, -1}, {-1, 0, -1}}],
         Line[{{0, 0, 1}, {0, 0, -1}}]
         }]
       ]
      ], borderWidth], {j, 1, frames3}]];
(* Export, with first, last, and intermission frames lengthened *)
Export["hyperboloidAnim.gif", hyperbList, 
 "DisplayDurations" -> {1, Splice@ConstantArray[1/15, frames - 1], 1, 
   Splice@ConstantArray[1/15, frames2 - 1], 1, 
   Splice@ConstantArray[1/15, frames3 - 1], 1}]

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:05, 16 May 2024Thumbnail for version as of 22:05, 16 May 2024370 × 470 (9.88 MB)Lemondoge (talk | contribs)Uploaded own work with UploadWizard

The following page uses this file: