Experimental forum for "Technology" discussions (computers, cameras, etc).

Re: Simple (and Primitive) 3D Rendering Program

Postby Bob Kuczewski » Fri Oct 21, 2022 3:30 am

I've added the new frame_designer program to our designer page at:

      https://ushawks.org/designer/frame_designer.htm

I've also updated the original glider_designer program at:

      https://ushawks.org/designer/glider_designer.htm

The older version is still available at:

      https://ushawks.org/designer/1.0/index.htm

I'll discuss the features in subsequent posts.
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7792
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Simple (and Primitive) 3D Rendering Program

Postby Bob Kuczewski » Fri Oct 21, 2022 3:37 am

Before getting into details, I'd like to mention the file types and formats available.

At this point, there are basically 3 file types supported by these programs:


The first one (Glider Designer Format) is a highly structured file that describes a "typical" hang glider using a number of named fields. There are currently 2 versions (1.0 and 1.1). Here's an example:

Code: Select all
{
  'Version': 1.1,
  'KeelFrontPoint': [0,5,0],
  'KeelRearPoint': [0,-5,0],
  'WingTipPoint': [15,-3,0.2],
  'TrailingEdgePercentKeel': 80,
  'RearWirePercentKeel': 82,
  'ControlBar': {
    'Height': 3.5,
    'Width': 3.2,
    'ApexPercentKeel': 40,
    'RakeDistance': 1.0,
    },
  'CrossBar': {
    'PercentKeel': 33,
    'PercentLeadingEdge': 60,
    'HeightAboveKeel': 0.1,
    },
  'KingPost': {
    'PercentKeel': 40,
    'Height': 3,
    'RakeDistance': 0.1,
    },
  'Battens': {
    'BattenDefData': [
      0.0, 20.0, 50.0, 165.0, 125.0, 20.0, 275.0, 150.0, 685.0, 160.0, 100.0,
      20.0, 225.0, 305.0, 240.0, 295.0, 260.0, 300.0, 350.0, 315.0
    ],
    'NumPerSide': 2,
    'BattenList': [
      {
        'PercentLeadingEdge': 0,
        'Segments': 20,
        'LeadingEdge': [50.0,165.0],
        'LeadingEdgeControl': [125.0,20.0],
        'TrailingEdgeControl': [275.0,150.0],
        'TrailingEdge': [685.0,160.0]
      },
      {
        'PercentLeadingEdge': 100,
        'Segments': 20,
        'LeadingEdge': [225.0,305.0],
        'LeadingEdgeControl': [240.0,295.0],
        'TrailingEdgeControl': [260.0,300.0],
        'TrailingEdge': [350.0,315.0]
      }
    ]
  }
}


Those fields match up pretty well with the fields in the user interface shown here:

Glider_Designer_Fields.png
Glider_Designer_Fields.png (87.91 KiB) Viewed 352 times


So the user can change the fields, and then click the "Update JSON from Model" button to convert all of those settings into the Glider Data text window so it can be copied and stored on your own computer. The file can then be copied and pasted back into the Glider Data text window and reloaded with the "Update Model from JSON" button. That gives everyone the ability to make and keep their own models.

There are now two new buttons in that row:

The first new button is the "Lines" button, and it will save every line segement from the model into the Glider Data text window using the Line Segment Format. Line Segment Format just lists two endpoints for a line along with the line thickness and color. It is the simple format used by the new Frame Designer program.

The second new button is the "Obj" button, and it will convert the model into Wavefront's ".obj" format. Unlike the other two formats, the ".obj" format is an industry standard for three dimensional graphics. You can read up on that format on Wikipedia. The nice thing about that format is that it can be imported into other 3D programs like Blender.

Note that the program will allow you to convert the model data into these two new formats, but it won't let you convert it back. That's because the specific information about the glider's design is NOT preserved in these two newly supported formats. These new formats just describe points and lines and don't have any representation for keels or downtubes.

The second file format is what I call "Line Segment Format" and it is the input to the new (and primitive) frame_designer program. The Line Segment Format is also JSON, but it's simply a series of lists (one per line to be drawn) inside of one large list. In JSON, a list of items is enclosed in a pair of square brackets ( [ ] ). Here's what that file format looks like:

Code: Select all
[
[0,5,0, 0,-5,0, 3, "ddddee"],
[15,-3,0.2, 0,5,0, 3, "ddddee"],
[15,-3,0.2, 0,5,0, 3, "ddddee"],
[0,5,0, -15,-3,0.2, 3, "ddddee"],
[0,1.7,0.1, 9,0.2,0.12, 5, "ddddee"],
[0,1.7,0.1, -9,0.2,0.12, 5, "ddddee"],
[0,1,0, -1.6,2,-3.5, 2, "ddddee"],
[0,1,0, 1.6,2,-3.5, 2, "ddddee"],
[-1.6,2,-3.5, 1.6,2,-3.5, 2, "ddddee"],
[0,1,0, 0,0.9,3, 2, "ddddee"],
[9,0.2,0.12, 1.6,2,-3.5, 1, "444444"],
[-9,0.2,0.12, -1.6,2,-3.5, 1, "444444"],
[0,5,0, 1.6,2,-3.5, 1, "444444"],
[0,5,0, -1.6,2,-3.5, 1, "444444"],
[0,-3.2,0, 1.6,2,-3.5, 1, "444444"],
[0,-3.2,0, -1.6,2,-3.5, 1, "444444"],
[0,0.9,3, 0,5,0, 1, "444444"],
[0,0.9,3, 0,-3.2,0, 1, "444444"],
[9,0.2,0.12, 0,0.9,3, 1, "444444"],
[-9,0.2,0.12, 0,0.9,3, 1, "444444"],
[0,5,0, 0,4.742251094905008,0.38784533177372765, 2, "55aadd"],
[0,4.742251094905008,0.38784533177372765, 0,4.3313012963985855,0.7054862490370097, 2, "55aadd"],
[0,4.3313012963985855,0.7054862490370097, 0,3.92756536483687,0.8289233064920131, 2, "55aadd"],
[0,3.92756536483687,0.8289233064920131, 0,3.5240241803386994,0.8571567913108474, 2, "55aadd"],
[0,3.5240241803386994,0.8571567913108474, 0,3.1080189480812677,0.8328670263763542, 2, "55aadd"],
[0,3.1080189480812677,0.8328670263763542, 0,2.7047256205562284,0.7812364607657823, 2, "55aadd"],
[0,2.7047256205562284,0.7812364607657823, 0,2.301512107115242,0.7151862127941968, 2, "55aadd"],
[0,2.301512107115242,0.7151862127941968, 0,1.8857640759430736,0.6402046139726949, 2, "55aadd"],
[0,1.8857640759430736,0.6402046139726949, 0,1.4826660020431564,0.5657876623429037, 2, "55aadd"],
[0,1.4826660020431564,0.5657876623429037, 0,1.0670147092582307,0.49055649796862477, 2, "55aadd"],
[0,1.0670147092582307,0.49055649796862477, 0,0.663994233245397,0.4210937523211147, 2, "55aadd"],
[0,0.663994233245397,0.4210937523211147, 0,0.26100322083377225,0.3563617930410688, 2, "55aadd"],
[0,0.26100322083377225,0.3563617930410688, 0,-0.15455479813431428,0.29543723376866626, 2, "55aadd"],
[0,-0.15455479813431428,0.29543723376866626, 0,-0.5574979164168168,0.24255106342287217, 2, "55aadd"],
[0,-0.5574979164168168,0.24255106342287217, 0,-0.9604218941228142,0.19608358827337133, 2, "55aadd"],
[0,-0.9604218941228142,0.19608358827337133, 0,-1.3759195735480265,0.15507191238808557, 2, "55aadd"],
[0,-1.3759195735480265,0.15507191238808557, 0,-1.7788111989713098,0.12207956898895782, 2, "55aadd"],
[0,-1.7788111989713098,0.12207956898895782, 0,-2.1816894381282523,0.09576619748221092, 2, "55aadd"],
[0,-2.1816894381282523,0.09576619748221092, 0,-2.5971450207303732,0.0755810592751398, 2, "55aadd"],
[0,-2.5971450207303732,0.0755810592751398, 0,-3,0.06266937871188018, 2, "55aadd"],
[-15,-3,0.2, -15,-3.0636178135161876,0.23393152861059405, 2, "55aadd"],
[-15,-3.0636178135161876,0.23393152861059405, -15,-3.1530663735951063,0.2580943204191667, 2, "55aadd"],
[-15,-3.1530663735951063,0.2580943204191667, -15,-3.229698501577891,0.2649576882534699, 2, "55aadd"],
[-15,-3.229698501577891,0.2649576882534699, -15,-3.306191414042995,0.26453564500890303, 2, "55aadd"],
[-15,-3.306191414042995,0.26453564500890303, -15,-3.3952622761771747,0.25864466475071884, 2, "55aadd"],
[-15,-3.3952622761771747,0.25864466475071884, -15,-3.471487629862323,0.25077224579630997, 2, "55aadd"],
[-15,-3.471487629862323,0.25077224579630997, -15,-3.5476237428982706,0.24125126275755834, 2, "55aadd"],
[-15,-3.5476237428982706,0.24125126275755834, -15,-3.623687710001141,0.23062826705155573, 2, "55aadd"],
[-15,-3.623687710001141,0.23062826705155573, -15,-3.712355320519258,0.21730479801726252, 2, "55aadd"],
[-15,-3.712355320519258,0.21730479801726252, -15,-3.7883044294889654,0.20534868753328653, 2, "55aadd"],
[-15,-3.7883044294889654,0.20534868753328653, -15,-3.864213956826103,0.19306134772288217, 2, "55aadd"],
[-15,-3.864213956826103,0.19306134772288217, -15,-3.952732991027377,0.17844951363284392, 2, "55aadd"],
[-15,-3.952732991027377,0.17844951363284392, -15,-4.028575767537186,0.165774822590392, 2, "55aadd"],
[-15,-4.028575767537186,0.165774822590392, -15,-4.104394208388233,0.15301954350661795, 2, "55aadd"],
[-15,-4.104394208388233,0.15301954350661795, -15,-4.192822354090225,0.1380899217998602, 2, "55aadd"],
[-15,-4.192822354090225,0.1380899217998602, -15,-4.268597876666099,0.12528564449015475, 2, "55aadd"],
[-15,-4.268597876666099,0.12528564449015475, -15,-4.344357098215104,0.11249809127215026, 2, "55aadd"],
[-15,-4.344357098215104,0.11249809127215026, -15,-4.420101756654016,0.099744135179592, 2, "55aadd"],
[-15,-4.420101756654016,0.099744135179592, -15,-4.508454080827354,0.0849240545638455, 2, "55aadd"],
[-15,-4.508454080827354,0.0849240545638455, -15,-4.584171983987645,0.072283256030478, 2, "55aadd"],
[15,-3,0.2, 15,-3.0636178135161876,0.23393152861059405, 2, "55aadd"],
[15,-3.0636178135161876,0.23393152861059405, 15,-3.1530663735951063,0.2580943204191667, 2, "55aadd"],
[15,-3.1530663735951063,0.2580943204191667, 15,-3.229698501577891,0.2649576882534699, 2, "55aadd"],
[15,-3.229698501577891,0.2649576882534699, 15,-3.306191414042995,0.26453564500890303, 2, "55aadd"],
[15,-3.306191414042995,0.26453564500890303, 15,-3.3952622761771747,0.25864466475071884, 2, "55aadd"],
[15,-3.3952622761771747,0.25864466475071884, 15,-3.471487629862323,0.25077224579630997, 2, "55aadd"],
[15,-3.471487629862323,0.25077224579630997, 15,-3.5476237428982706,0.24125126275755834, 2, "55aadd"],
[15,-3.5476237428982706,0.24125126275755834, 15,-3.623687710001141,0.23062826705155573, 2, "55aadd"],
[15,-3.623687710001141,0.23062826705155573, 15,-3.712355320519258,0.21730479801726252, 2, "55aadd"],
[15,-3.712355320519258,0.21730479801726252, 15,-3.7883044294889654,0.20534868753328653, 2, "55aadd"],
[15,-3.7883044294889654,0.20534868753328653, 15,-3.864213956826103,0.19306134772288217, 2, "55aadd"],
[15,-3.864213956826103,0.19306134772288217, 15,-3.952732991027377,0.17844951363284392, 2, "55aadd"],
[15,-3.952732991027377,0.17844951363284392, 15,-4.028575767537186,0.165774822590392, 2, "55aadd"],
[15,-4.028575767537186,0.165774822590392, 15,-4.104394208388233,0.15301954350661795, 2, "55aadd"],
[15,-4.104394208388233,0.15301954350661795, 15,-4.192822354090225,0.1380899217998602, 2, "55aadd"],
[15,-4.192822354090225,0.1380899217998602, 15,-4.268597876666099,0.12528564449015475, 2, "55aadd"],
[15,-4.268597876666099,0.12528564449015475, 15,-4.344357098215104,0.11249809127215026, 2, "55aadd"],
[15,-4.344357098215104,0.11249809127215026, 15,-4.420101756654016,0.099744135179592, 2, "55aadd"],
[15,-4.420101756654016,0.099744135179592, 15,-4.508454080827354,0.0849240545638455, 2, "55aadd"],
[15,-4.508454080827354,0.0849240545638455, 15,-4.584171983987645,0.072283256030478, 2, "55aadd"],
[-15,-3,0.2, 0,5,0, 1, "000077"],
[0,5,0, 15,-3,0.2, 1, "000077"],
[-15,-3.0636178135161876,0.23393152861059405, 0,4.742251094905008,0.38784533177372765, 1, "000077"],
[0,4.742251094905008,0.38784533177372765, 15,-3.0636178135161876,0.23393152861059405, 1, "000077"],
[-15,-3.1530663735951063,0.2580943204191667, 0,4.3313012963985855,0.7054862490370097, 1, "000077"],
[0,4.3313012963985855,0.7054862490370097, 15,-3.1530663735951063,0.2580943204191667, 1, "000077"],
[-15,-3.229698501577891,0.2649576882534699, 0,3.92756536483687,0.8289233064920131, 1, "000077"],
[0,3.92756536483687,0.8289233064920131, 15,-3.229698501577891,0.2649576882534699, 1, "000077"],
[-15,-3.306191414042995,0.26453564500890303, 0,3.5240241803386994,0.8571567913108474, 1, "000077"],
[0,3.5240241803386994,0.8571567913108474, 15,-3.306191414042995,0.26453564500890303, 1, "000077"],
[-15,-3.3952622761771747,0.25864466475071884, 0,3.1080189480812677,0.8328670263763542, 1, "000077"],
[0,3.1080189480812677,0.8328670263763542, 15,-3.3952622761771747,0.25864466475071884, 1, "000077"],
[-15,-3.471487629862323,0.25077224579630997, 0,2.7047256205562284,0.7812364607657823, 1, "000077"],
[0,2.7047256205562284,0.7812364607657823, 15,-3.471487629862323,0.25077224579630997, 1, "000077"],
[-15,-3.5476237428982706,0.24125126275755834, 0,2.301512107115242,0.7151862127941968, 1, "000077"],
[0,2.301512107115242,0.7151862127941968, 15,-3.5476237428982706,0.24125126275755834, 1, "000077"],
[-15,-3.623687710001141,0.23062826705155573, 0,1.8857640759430736,0.6402046139726949, 1, "000077"],
[0,1.8857640759430736,0.6402046139726949, 15,-3.623687710001141,0.23062826705155573, 1, "000077"],
[-15,-3.712355320519258,0.21730479801726252, 0,1.4826660020431564,0.5657876623429037, 1, "000077"],
[0,1.4826660020431564,0.5657876623429037, 15,-3.712355320519258,0.21730479801726252, 1, "000077"],
[-15,-3.7883044294889654,0.20534868753328653, 0,1.0670147092582307,0.49055649796862477, 1, "000077"],
[0,1.0670147092582307,0.49055649796862477, 15,-3.7883044294889654,0.20534868753328653, 1, "000077"],
[-15,-3.864213956826103,0.19306134772288217, 0,0.663994233245397,0.4210937523211147, 1, "000077"],
[0,0.663994233245397,0.4210937523211147, 15,-3.864213956826103,0.19306134772288217, 1, "000077"],
[-15,-3.952732991027377,0.17844951363284392, 0,0.26100322083377225,0.3563617930410688, 1, "000077"],
[0,0.26100322083377225,0.3563617930410688, 15,-3.952732991027377,0.17844951363284392, 1, "000077"],
[-15,-4.028575767537186,0.165774822590392, 0,-0.15455479813431428,0.29543723376866626, 1, "000077"],
[0,-0.15455479813431428,0.29543723376866626, 15,-4.028575767537186,0.165774822590392, 1, "000077"],
[-15,-4.104394208388233,0.15301954350661795, 0,-0.5574979164168168,0.24255106342287217, 1, "000077"],
[0,-0.5574979164168168,0.24255106342287217, 15,-4.104394208388233,0.15301954350661795, 1, "000077"],
[-15,-4.192822354090225,0.1380899217998602, 0,-0.9604218941228142,0.19608358827337133, 1, "000077"],
[0,-0.9604218941228142,0.19608358827337133, 15,-4.192822354090225,0.1380899217998602, 1, "000077"],
[-15,-4.268597876666099,0.12528564449015475, 0,-1.3759195735480265,0.15507191238808557, 1, "000077"],
[0,-1.3759195735480265,0.15507191238808557, 15,-4.268597876666099,0.12528564449015475, 1, "000077"],
[-15,-4.344357098215104,0.11249809127215026, 0,-1.7788111989713098,0.12207956898895782, 1, "000077"],
[0,-1.7788111989713098,0.12207956898895782, 15,-4.344357098215104,0.11249809127215026, 1, "000077"],
[-15,-4.420101756654016,0.099744135179592, 0,-2.1816894381282523,0.09576619748221092, 1, "000077"],
[0,-2.1816894381282523,0.09576619748221092, 15,-4.420101756654016,0.099744135179592, 1, "000077"],
[-15,-4.508454080827354,0.0849240545638455, 0,-2.5971450207303732,0.0755810592751398, 1, "000077"],
[0,-2.5971450207303732,0.0755810592751398, 15,-4.508454080827354,0.0849240545638455, 1, "000077"],
[-15,-4.584171983987645,0.072283256030478, 0,-3,0.06266937871188018, 1, "000077"],
[0,-3,0.06266937871188018, 15,-4.584171983987645,0.072283256030478, 1, "000077"],
]


You can copy that text and save it on your local computer. You can also paste it into the frame_designer program here:

      https://ushawks.org/designer/frame_designer.htm

The output from both glider_designer and frame_designer will be pretty much identical:

Glider_Designer_Image.png
Glider_Designer_Image.png (35.92 KiB) Viewed 352 times


The difference is that the "frame_designer" program is highly unconstrained as to what you can do with it. You can modify or add segments of any color and size wherever you like. For example, if you change the first line of the default Line Segment file from containing an initial 5, a width of 3, and a color of "ddddee":

      [0,5,0, 0,-5,0, 3, "ddddee"],

to containing an initial 10, a width of 5, and a color of "ff8888":

      [0,10,0, 0,-5,0, 5, "ff8888"],

you'll get this extended keel or "bow sprit" version with the specified new thickness and color:

Pink_thick_extended_Keel.png
Pink_thick_extended_Keel.png (31.27 KiB) Viewed 351 times

The new program can also generate a ".obj" format for either saving or importing into other tools. Just click the "Make .obj" button, and you'll get a pop-up box containing the glider's description in ".obj" format. Then select it all, copy it to the clipboard, and paste it into another program or a text editor to save. Here's what that ".obj" file looks like:

Code: Select all
o Glider
v 0 0 -10
v 0 0 5
v -15 0.2 3
v 0 0 -5
v 15 0.2 3
v 0 0.1 -1.7000000000000002
v -9 0.12 -0.20000000000000018
v 9 0.12 -0.20000000000000018
v 0 0 -1
v 1.6 -3.5 -2
v -1.6 -3.5 -2
v 0 3 -0.9
v 0 0 3.1999999999999993
v 0 0.38784533177372765 -4.742251094905008
v 0 0.7054862490370097 -4.3313012963985855
v 0 0.8289233064920131 -3.92756536483687
v 0 0.8571567913108474 -3.5240241803386994
v 0 0.8328670263763542 -3.1080189480812677
v 0 0.7812364607657823 -2.7047256205562284
v 0 0.7151862127941968 -2.301512107115242
v 0 0.6402046139726949 -1.8857640759430736
v 0 0.5657876623429037 -1.4826660020431564
v 0 0.49055649796862477 -1.0670147092582307
v 0 0.4210937523211147 -0.663994233245397
v 0 0.3563617930410688 -0.26100322083377225
v 0 0.29543723376866626 0.15455479813431428
v 0 0.24255106342287217 0.5574979164168168
v 0 0.19608358827337133 0.9604218941228142
v 0 0.15507191238808557 1.3759195735480265
v 0 0.12207956898895782 1.7788111989713098
v 0 0.09576619748221092 2.1816894381282523
v 0 0.0755810592751398 2.5971450207303732
v 0 0.06266937871188018 3
v 15 0.23393152861059405 3.0636178135161876
v 15 0.2580943204191667 3.1530663735951063
v 15 0.2649576882534699 3.229698501577891
v 15 0.26453564500890303 3.306191414042995
v 15 0.25864466475071884 3.3952622761771747
v 15 0.25077224579630997 3.471487629862323
v 15 0.24125126275755834 3.5476237428982706
v 15 0.23062826705155573 3.623687710001141
v 15 0.21730479801726252 3.712355320519258
v 15 0.20534868753328653 3.7883044294889654
v 15 0.19306134772288217 3.864213956826103
v 15 0.17844951363284392 3.952732991027377
v 15 0.165774822590392 4.028575767537186
v 15 0.15301954350661795 4.104394208388233
v 15 0.1380899217998602 4.192822354090225
v 15 0.12528564449015475 4.268597876666099
v 15 0.11249809127215026 4.344357098215104
v 15 0.099744135179592 4.420101756654016
v 15 0.0849240545638455 4.508454080827354
v 15 0.072283256030478 4.584171983987645
v -15 0.23393152861059405 3.0636178135161876
v -15 0.2580943204191667 3.1530663735951063
v -15 0.2649576882534699 3.229698501577891
v -15 0.26453564500890303 3.306191414042995
v -15 0.25864466475071884 3.3952622761771747
v -15 0.25077224579630997 3.471487629862323
v -15 0.24125126275755834 3.5476237428982706
v -15 0.23062826705155573 3.623687710001141
v -15 0.21730479801726252 3.712355320519258
v -15 0.20534868753328653 3.7883044294889654
v -15 0.19306134772288217 3.864213956826103
v -15 0.17844951363284392 3.952732991027377
v -15 0.165774822590392 4.028575767537186
v -15 0.15301954350661795 4.104394208388233
v -15 0.1380899217998602 4.192822354090225
v -15 0.12528564449015475 4.268597876666099
v -15 0.11249809127215026 4.344357098215104
v -15 0.099744135179592 4.420101756654016
v -15 0.0849240545638455 4.508454080827354
v -15 0.072283256030478 4.584171983987645
l 1 2
l 3 4
l 3 4
l 4 5
l 6 7
l 6 8
l 9 10
l 9 11
l 10 11
l 9 12
l 7 11
l 8 10
l 4 11
l 4 10
l 13 11
l 13 10
l 12 4
l 12 13
l 7 12
l 8 12
l 4 14
l 14 15
l 15 16
l 16 17
l 17 18
l 18 19
l 19 20
l 20 21
l 21 22
l 22 23
l 23 24
l 24 25
l 25 26
l 26 27
l 27 28
l 28 29
l 29 30
l 30 31
l 31 32
l 32 33
l 5 34
l 34 35
l 35 36
l 36 37
l 37 38
l 38 39
l 39 40
l 40 41
l 41 42
l 42 43
l 43 44
l 44 45
l 45 46
l 46 47
l 47 48
l 48 49
l 49 50
l 50 51
l 51 52
l 52 53
l 3 54
l 54 55
l 55 56
l 56 57
l 57 58
l 58 59
l 59 60
l 60 61
l 61 62
l 62 63
l 63 64
l 64 65
l 65 66
l 66 67
l 67 68
l 68 69
l 69 70
l 70 71
l 71 72
l 72 73
l 5 4
l 4 3
l 34 14
l 14 54
l 35 15
l 15 55
l 36 16
l 16 56
l 37 17
l 17 57
l 38 18
l 18 58
l 39 19
l 19 59
l 40 20
l 20 60
l 41 21
l 21 61
l 42 22
l 22 62
l 43 23
l 23 63
l 44 24
l 24 64
l 45 25
l 25 65
l 46 26
l 26 66
l 47 27
l 27 67
l 48 28
l 28 68
l 49 29
l 29 69
l 50 30
l 30 70
l 51 31
l 31 71
l 52 32
l 32 72
l 53 33
l 33 73


Note that this method of building a glider FIRST in glider_designer and then passing it on to frame_designer for customization can save a lot of work. The glider_designer program has great tools for laying out the basics of most "normal" gliders. But once exported as a series of lines, those lines can be modified any way that you need in frame_designer. So you generally want to make as many changes as glider_designer will allow, and then make the final changes in frame_designer.

I hope that helps!
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7792
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Simple (and Primitive) 3D Rendering Program

Postby JoeF » Fri Oct 21, 2022 1:35 pm

Started playing with US Hawks Glider Designer:
USHawksGliderDesigner.jpg


-----
Also, I started on some tutorial for Blender.

Thanks. Thanks. :salute: :salute:
Join a National Hang Gliding Organization: US Hawks at ushawks.org

View pilots' hang gliding rating at: US Hang Gliding Rating System
JoeF
User avatar
Contributor
Contributor
 
Posts: 3912
Joined: Sat Aug 14, 2010 3:41 pm

Re: Simple (and Primitive) 3D Rendering Program

Postby Bob Kuczewski » Sat Nov 05, 2022 2:27 am

Hi Joe, here's a version with a High Hat just for you:

High_Hat_001.gif
High_Hat_001.gif (862.21 KiB) Viewed 179 times


And here's a dodecahedron (just for fun):

Dodecahedron.gif
Dodecahedron.gif (328.3 KiB) Viewed 173 times
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7792
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Simple (and Primitive) 3D Rendering Program

Postby JoeF » Sat Nov 05, 2022 3:52 pm

Fun! Please post the codes for those two creations. TIA. Or maybe you installed them in the program; I will go look.
Join a National Hang Gliding Organization: US Hawks at ushawks.org

View pilots' hang gliding rating at: US Hang Gliding Rating System
JoeF
User avatar
Contributor
Contributor
 
Posts: 3912
Joined: Sat Aug 14, 2010 3:41 pm

Re: Simple (and Primitive) 3D Rendering Program

Postby Craig Muhonen » Sat Nov 05, 2022 5:54 pm

Amazing Bob, you have seemed to draw 2 dodecahedron's in the same picture, one spinning clockwise and the same one spinning counter-clockwise, and vice versa. Pure genius. I guess that you really can be it two places at the same time. My eyes went crazy trying to see both spins at the same time. Oh I see, it starts and stops at 180 degrees, you programmer you.
Here's a puzzle;
PG seems to have it's own, sorta' AI, that includes HG.
Couldn't HG have it's own AI that doesn't include PG?
You gotta' push the stick forward while you're lookn' at the ground
Craig Muhonen
User avatar
Contributor
Contributor
 
Posts: 778
Joined: Tue Nov 05, 2019 9:58 pm
Location: The Canyons of the Ancients

Re: Simple (and Primitive) 3D Rendering Program

Postby Bob Kuczewski » Sat Nov 05, 2022 8:43 pm

Craig Muhonen wrote:Amazing Bob, you have seemed to draw 2 dodecahedron's in the same picture, one spinning clockwise and the same one spinning counter-clockwise, and vice versa. Pure genius. I guess that you really can be it two places at the same time. My eyes went crazy trying to see both spins at the same time.


Your eyes (and mostly your brain) are telling you that something's not natural about that picture. Something's wrong. There are actually 2 things that are wrong and both of them lead to the ambiguity that you experience through your visual system.

1. The current progam has no provision for "hidden line removal". In other words, the lines are drawn on the screen in some order that causes some lines to be drawn over other lines when they should actually be behind those other lines.

2. The current program has no provision for perspective. Everything is drawn in what's known as an "orthographic" view. So things that are further away don't appear reduced in size as they normally should be.


There are much better programs that can draw scenes with both hidden line removal and perspective. But for this case, I just wanted something small and simple without any external dependencies.

JoeF wrote:Fun! Please post the codes for those two creations. TIA. Or maybe you installed them in the program; I will go look.


Sure Joe.

Here's the code for the glider with the High Hat:

Glider with High Hat:
Code: Select all
[

 [    0,   5,    0,      0,  -5,    0,   3, "ddddee" ],
 [   15,  -3,  0.2,      0,   5,    0,   3, "ddddee" ],
 [   15,  -3,  0.2,      0,   5,    0,   3, "ddddee" ],
 [    0,   5,    0,    -15,  -3,  0.2,   3, "ddddee" ],
 [    0, 1.7,  0.1,      9, 0.2, 0.12,   5, "ddddee" ],
 [    0, 1.7,  0.1,     -9, 0.2, 0.12,   5, "ddddee" ],
 [    0,   1,    0,   -1.6,   2, -3.5,   2, "ddddee" ],
 [    0,   1,    0,    1.6,   2, -3.5,   2, "ddddee" ],
 [ -1.6,   2, -3.5,    1.6,   2, -3.5,   2, "ddddee" ],

 // High Hat

 [    0,   1,    0,   -0.9, 0.9,    3,   2, "ddddee" ],
 [  0.9, 0.9,    3,   -0.9, 0.9,    3,   2, "ddddee" ],

 [  9,  0.2, 0.12,    1.6,    2, -3.5,   1, "444444" ],
 [ -9,  0.2, 0.12,   -1.6,    2, -3.5,   1, "444444" ],
 [  0,    5,    0,    1.6,    2, -3.5,   1, "444444" ],
 [  0,    5,    0,   -1.6,    2, -3.5,   1, "444444" ],
 [  0, -3.2,    0,    1.6,    2, -3.5,   1, "444444" ],
 [  0, -3.2,    0,   -1.6,    2, -3.5,   1, "444444" ],

 [  0.9,  0.9,  3,      0,    5,    0,   1, "444444" ], // Top front wire
 [  0.9,  0.9,  3,      0, -3.2,    0,   1, "444444" ], // Top rear wire

 [  0.9,  0.9,  3,      9,  0.2, 0.12,   1, "444444" ], // Top side wire
 [ -0.9,  0.9,  3,     -9,  0.2, 0.12,   1, "444444" ], // Top side wire

 [ 0, 5, 0, 0, 4.742251094905008, 0.38784533177372765, 2, "55aadd" ],
 [ 0, 4.742251094905008, 0.38784533177372765, 0, 4.3313012963985855, 0.7054862490370097, 2, "55aadd" ],
 [ 0, 4.3313012963985855, 0.7054862490370097, 0, 3.92756536483687, 0.8289233064920131, 2, "55aadd" ],
 [ 0, 3.92756536483687, 0.8289233064920131, 0, 3.5240241803386994, 0.8571567913108474, 2, "55aadd" ],
 [ 0, 3.5240241803386994, 0.8571567913108474, 0, 3.1080189480812677, 0.8328670263763542, 2, "55aadd" ],
 [ 0, 3.1080189480812677, 0.8328670263763542, 0, 2.7047256205562284, 0.7812364607657823, 2, "55aadd" ],
 [ 0, 2.7047256205562284, 0.7812364607657823, 0, 2.301512107115242, 0.7151862127941968, 2, "55aadd" ],
 [ 0, 2.301512107115242, 0.7151862127941968, 0, 1.8857640759430736, 0.6402046139726949, 2, "55aadd" ],
 [ 0, 1.8857640759430736, 0.6402046139726949, 0, 1.4826660020431564, 0.5657876623429037, 2, "55aadd" ],
 [ 0, 1.4826660020431564, 0.5657876623429037, 0, 1.0670147092582307, 0.49055649796862477, 2, "55aadd" ],
 [ 0, 1.0670147092582307, 0.49055649796862477, 0, 0.663994233245397, 0.4210937523211147, 2, "55aadd" ],
 [ 0, 0.663994233245397, 0.4210937523211147, 0, 0.26100322083377225, 0.3563617930410688, 2, "55aadd" ],
 [ 0, 0.26100322083377225, 0.3563617930410688, 0, -0.15455479813431428, 0.29543723376866626, 2, "55aadd" ],
 [ 0, -0.15455479813431428, 0.29543723376866626, 0, -0.5574979164168168, 0.24255106342287217, 2, "55aadd" ],
 [ 0, -0.5574979164168168, 0.24255106342287217, 0, -0.9604218941228142, 0.19608358827337133, 2, "55aadd" ],
 [ 0, -0.9604218941228142, 0.19608358827337133, 0, -1.3759195735480265, 0.15507191238808557, 2, "55aadd" ],
 [ 0, -1.3759195735480265, 0.15507191238808557, 0, -1.7788111989713098, 0.12207956898895782, 2, "55aadd" ],
 [ 0, -1.7788111989713098, 0.12207956898895782, 0, -2.1816894381282523, 0.09576619748221092, 2, "55aadd" ],
 [ 0, -2.1816894381282523, 0.09576619748221092, 0, -2.5971450207303732, 0.0755810592751398, 2, "55aadd" ],
 [ 0, -2.5971450207303732, 0.0755810592751398, 0, -3, 0.06266937871188018, 2, "55aadd" ],
 [ -15, -3, 0.2, -15, -3.0636178135161876, 0.23393152861059405, 2, "55aadd" ],
 [ -15, -3.0636178135161876, 0.23393152861059405, -15, -3.1530663735951063, 0.2580943204191667, 2, "55aadd" ],
 [ -15, -3.1530663735951063, 0.2580943204191667, -15, -3.229698501577891, 0.2649576882534699, 2, "55aadd" ],
 [ -15, -3.229698501577891, 0.2649576882534699, -15, -3.306191414042995, 0.26453564500890303, 2, "55aadd" ],
 [ -15, -3.306191414042995, 0.26453564500890303, -15, -3.3952622761771747, 0.25864466475071884, 2, "55aadd" ],
 [ -15, -3.3952622761771747, 0.25864466475071884, -15, -3.471487629862323, 0.25077224579630997, 2, "55aadd" ],
 [ -15, -3.471487629862323, 0.25077224579630997, -15, -3.5476237428982706, 0.24125126275755834, 2, "55aadd" ],
 [ -15, -3.5476237428982706, 0.24125126275755834, -15, -3.623687710001141, 0.23062826705155573, 2, "55aadd" ],
 [ -15, -3.623687710001141, 0.23062826705155573, -15, -3.712355320519258, 0.21730479801726252, 2, "55aadd" ],
 [ -15, -3.712355320519258, 0.21730479801726252, -15, -3.7883044294889654, 0.20534868753328653, 2, "55aadd" ],
 [ -15, -3.7883044294889654, 0.20534868753328653, -15, -3.864213956826103, 0.19306134772288217, 2, "55aadd" ],
 [ -15, -3.864213956826103, 0.19306134772288217, -15, -3.952732991027377, 0.17844951363284392, 2, "55aadd" ],
 [ -15, -3.952732991027377, 0.17844951363284392, -15, -4.028575767537186, 0.165774822590392, 2, "55aadd" ],
 [ -15, -4.028575767537186, 0.165774822590392, -15, -4.104394208388233, 0.15301954350661795, 2, "55aadd" ],
 [ -15, -4.104394208388233, 0.15301954350661795, -15, -4.192822354090225, 0.1380899217998602, 2, "55aadd" ],
 [ -15, -4.192822354090225, 0.1380899217998602, -15, -4.268597876666099, 0.12528564449015475, 2, "55aadd" ],
 [ -15, -4.268597876666099, 0.12528564449015475, -15, -4.344357098215104, 0.11249809127215026, 2, "55aadd" ],
 [ -15, -4.344357098215104, 0.11249809127215026, -15, -4.420101756654016, 0.099744135179592, 2, "55aadd" ],
 [ -15, -4.420101756654016, 0.099744135179592, -15, -4.508454080827354, 0.0849240545638455, 2, "55aadd" ],
 [ -15, -4.508454080827354, 0.0849240545638455, -15, -4.584171983987645, 0.072283256030478, 2, "55aadd" ],
 [ 15, -3, 0.2, 15, -3.0636178135161876, 0.23393152861059405, 2, "55aadd" ],
 [ 15, -3.0636178135161876, 0.23393152861059405, 15, -3.1530663735951063, 0.2580943204191667, 2, "55aadd" ],
 [ 15, -3.1530663735951063, 0.2580943204191667, 15, -3.229698501577891, 0.2649576882534699, 2, "55aadd" ],
 [ 15, -3.229698501577891, 0.2649576882534699, 15, -3.306191414042995, 0.26453564500890303, 2, "55aadd" ],
 [ 15, -3.306191414042995, 0.26453564500890303, 15, -3.3952622761771747, 0.25864466475071884, 2, "55aadd" ],
 [ 15, -3.3952622761771747, 0.25864466475071884, 15, -3.471487629862323, 0.25077224579630997, 2, "55aadd" ],
 [ 15, -3.471487629862323, 0.25077224579630997, 15, -3.5476237428982706, 0.24125126275755834, 2, "55aadd" ],
 [ 15, -3.5476237428982706, 0.24125126275755834, 15, -3.623687710001141, 0.23062826705155573, 2, "55aadd" ],
 [ 15, -3.623687710001141, 0.23062826705155573, 15, -3.712355320519258, 0.21730479801726252, 2, "55aadd" ],
 [ 15, -3.712355320519258, 0.21730479801726252, 15, -3.7883044294889654, 0.20534868753328653, 2, "55aadd" ],
 [ 15, -3.7883044294889654, 0.20534868753328653, 15, -3.864213956826103, 0.19306134772288217, 2, "55aadd" ],
 [ 15, -3.864213956826103, 0.19306134772288217, 15, -3.952732991027377, 0.17844951363284392, 2, "55aadd" ],
 [ 15, -3.952732991027377, 0.17844951363284392, 15, -4.028575767537186, 0.165774822590392, 2, "55aadd" ],
 [ 15, -4.028575767537186, 0.165774822590392, 15, -4.104394208388233, 0.15301954350661795, 2, "55aadd" ],
 [ 15, -4.104394208388233, 0.15301954350661795, 15, -4.192822354090225, 0.1380899217998602, 2, "55aadd" ],
 [ 15, -4.192822354090225, 0.1380899217998602, 15, -4.268597876666099, 0.12528564449015475, 2, "55aadd" ],
 [ 15, -4.268597876666099, 0.12528564449015475, 15, -4.344357098215104, 0.11249809127215026, 2, "55aadd" ],
 [ 15, -4.344357098215104, 0.11249809127215026, 15, -4.420101756654016, 0.099744135179592, 2, "55aadd" ],
 [ 15, -4.420101756654016, 0.099744135179592, 15, -4.508454080827354, 0.0849240545638455, 2, "55aadd" ],
 [ 15, -4.508454080827354, 0.0849240545638455, 15, -4.584171983987645, 0.072283256030478, 2, "55aadd" ],
 [ -15, -3, 0.2, 0, 5, 0, 1, "000077" ],
 [ 0, 5, 0, 15, -3, 0.2, 1, "000077" ],
 [ -15, -3.0636178135161876, 0.23393152861059405, 0, 4.742251094905008, 0.38784533177372765, 1, "000077" ],
 [ 0, 4.742251094905008, 0.38784533177372765, 15, -3.0636178135161876, 0.23393152861059405, 1, "000077" ],
 [ -15, -3.1530663735951063, 0.2580943204191667, 0, 4.3313012963985855, 0.7054862490370097, 1, "000077" ],
 [ 0, 4.3313012963985855, 0.7054862490370097, 15, -3.1530663735951063, 0.2580943204191667, 1, "000077" ],
 [ -15, -3.229698501577891, 0.2649576882534699, 0, 3.92756536483687, 0.8289233064920131, 1, "000077" ],
 [ 0, 3.92756536483687, 0.8289233064920131, 15, -3.229698501577891, 0.2649576882534699, 1, "000077" ],
 [ -15, -3.306191414042995, 0.26453564500890303, 0, 3.5240241803386994, 0.8571567913108474, 1, "000077" ],
 [ 0, 3.5240241803386994, 0.8571567913108474, 15, -3.306191414042995, 0.26453564500890303, 1, "000077" ],
 [ -15, -3.3952622761771747, 0.25864466475071884, 0, 3.1080189480812677, 0.8328670263763542, 1, "000077" ],
 [ 0, 3.1080189480812677, 0.8328670263763542, 15, -3.3952622761771747, 0.25864466475071884, 1, "000077" ],
 [ -15, -3.471487629862323, 0.25077224579630997, 0, 2.7047256205562284, 0.7812364607657823, 1, "000077" ],
 [ 0, 2.7047256205562284, 0.7812364607657823, 15, -3.471487629862323, 0.25077224579630997, 1, "000077" ],
 [ -15, -3.5476237428982706, 0.24125126275755834, 0, 2.301512107115242, 0.7151862127941968, 1, "000077" ],
 [ 0, 2.301512107115242, 0.7151862127941968, 15, -3.5476237428982706, 0.24125126275755834, 1, "000077" ],
 [ -15, -3.623687710001141, 0.23062826705155573, 0, 1.8857640759430736, 0.6402046139726949, 1, "000077" ],
 [ 0, 1.8857640759430736, 0.6402046139726949, 15, -3.623687710001141, 0.23062826705155573, 1, "000077" ],
 [ -15, -3.712355320519258, 0.21730479801726252, 0, 1.4826660020431564, 0.5657876623429037, 1, "000077" ],
 [ 0, 1.4826660020431564, 0.5657876623429037, 15, -3.712355320519258, 0.21730479801726252, 1, "000077" ],
 [ -15, -3.7883044294889654, 0.20534868753328653, 0, 1.0670147092582307, 0.49055649796862477, 1, "000077" ],
 [ 0, 1.0670147092582307, 0.49055649796862477, 15, -3.7883044294889654, 0.20534868753328653, 1, "000077" ],
 [ -15, -3.864213956826103, 0.19306134772288217, 0, 0.663994233245397, 0.4210937523211147, 1, "000077" ],
 [ 0, 0.663994233245397, 0.4210937523211147, 15, -3.864213956826103, 0.19306134772288217, 1, "000077" ],
 [ -15, -3.952732991027377, 0.17844951363284392, 0, 0.26100322083377225, 0.3563617930410688, 1, "000077" ],
 [ 0, 0.26100322083377225, 0.3563617930410688, 15, -3.952732991027377, 0.17844951363284392, 1, "000077" ],
 [ -15, -4.028575767537186, 0.165774822590392, 0, -0.15455479813431428, 0.29543723376866626, 1, "000077" ],
 [ 0, -0.15455479813431428, 0.29543723376866626, 15, -4.028575767537186, 0.165774822590392, 1, "000077" ],
 [ -15, -4.104394208388233, 0.15301954350661795, 0, -0.5574979164168168, 0.24255106342287217, 1, "000077" ],
 [ 0, -0.5574979164168168, 0.24255106342287217, 15, -4.104394208388233, 0.15301954350661795, 1, "000077" ],
 [ -15, -4.192822354090225, 0.1380899217998602, 0, -0.9604218941228142, 0.19608358827337133, 1, "000077" ],
 [ 0, -0.9604218941228142, 0.19608358827337133, 15, -4.192822354090225, 0.1380899217998602, 1, "000077" ],
 [ -15, -4.268597876666099, 0.12528564449015475, 0, -1.3759195735480265, 0.15507191238808557, 1, "000077" ],
 [ 0, -1.3759195735480265, 0.15507191238808557, 15, -4.268597876666099, 0.12528564449015475, 1, "000077" ],
 [ -15, -4.344357098215104, 0.11249809127215026, 0, -1.7788111989713098, 0.12207956898895782, 1, "000077" ],
 [ 0, -1.7788111989713098, 0.12207956898895782, 15, -4.344357098215104, 0.11249809127215026, 1, "000077" ],
 [ -15, -4.420101756654016, 0.099744135179592, 0, -2.1816894381282523, 0.09576619748221092, 1, "000077" ],
 [ 0, -2.1816894381282523, 0.09576619748221092, 15, -4.420101756654016, 0.099744135179592, 1, "000077" ],
 [ -15, -4.508454080827354, 0.0849240545638455, 0, -2.5971450207303732, 0.0755810592751398, 1, "000077" ],
 [ 0, -2.5971450207303732, 0.0755810592751398, 15, -4.508454080827354, 0.0849240545638455, 1, "000077" ],
 [ -15, -4.584171983987645, 0.072283256030478, 0, -3, 0.06266937871188018, 1, "000077" ],
 [ 0, -3, 0.06266937871188018, 15, -4.584171983987645, 0.072283256030478, 1, "000077" ],
]


Here's the code for the dodecahedron:

Dodecahedron:
Code: Select all
// Lines
 [        5,       -5,        5,    3.09017,        0,  8.09017,   1, "ff5555" ],
 [        0,  8.09017,  3.09017,          5,        5,        5,   1, "55ff55" ],
 [       -5,        5,        5,   -3.09017,        0,  8.09017,   1, "5555ff" ],
 [       -5,        5,        5,          0,  8.09017,  3.09017,   1, "ffff00" ],
 [  3.09017,        0,  8.09017,          5,        5,        5,   1, "ff00ff" ],
 [  3.09017,        0,  8.09017,   -3.09017,        0,  8.09017,   1, "55ffff" ],
 [        0,  8.09017,  3.09017,          0,  8.09017, -3.09017,   1, "ff5555" ],
 [ -3.09017,        0,  8.09017,         -5,       -5,        5,   1, "55ff55" ],
 [        5,        5,        5,    8.09017,  3.09017,        0,   1, "5555ff" ],
 [       -5,        5,        5,   -8.09017,  3.09017,        0,   1, "ff00ff" ],
 [        0, -8.09017,  3.09017,         -5,       -5,        5,   1, "5555ff" ],
 [       -5,       -5,        5,   -8.09017, -3.09017,        0,   1, "ffff00" ],
 [        0, -8.09017,  3.09017,          5,       -5,        5,   1, "ffff00" ],
 [        0, -8.09017, -3.09017,          0, -8.09017,  3.09017,   1, "ff00ff" ],
 [        5,       -5,        5,    8.09017, -3.09017,        0,   1, "55ff55" ],
 [  8.09017, -3.09017,        0,    8.09017,  3.09017,        0,   1, "55ffff" ],
 [  8.09017, -3.09017,        0,    8.09017,  3.09017,        0,   1, "ffff00" ],
 [  8.09017,  3.09017,        0,          5,        5,       -5,   1, "ff00ff" ],
 [        0,  8.09017, -3.09017,          5,        5,       -5,   1, "55ffff" ],
 [        5,        5,       -5,    3.09017,        0, -8.09017,   1, "ff5555" ],
 [  8.09017, -3.09017,        0,          5,       -5,       -5,   1, "5555ff" ],
 [ -8.09017, -3.09017,        0,   -8.09017,  3.09017,        0,   1, "ff5555" ],
 [ -8.09017,  3.09017,        0,         -5,        5,       -5,   1, "55ff55" ],
 [       -5,        5,       -5,          0,  8.09017, -3.09017,   1, "5555ff" ],
 [        5,       -5,       -5,          0, -8.09017, -3.09017,   1, "ff5555" ],
 [       -5,       -5,       -5,   -8.09017, -3.09017,        0,   1, "55ffff" ],
 [       -5,       -5,       -5,   -8.09017, -3.09017,        0,   1, "55ffff" ],
 [       -5,        5,       -5,   -3.09017,        0, -8.09017,   1, "ffff00" ],
 [        5,       -5,       -5,    3.09017,        0, -8.09017,   1, "55ff55" ],
 [        0, -8.09017, -3.09017,         -5,       -5,       -5,   1, "5555ff" ],
 [  3.09017,        0, -8.09017,   -3.09017,        0, -8.09017,   1, "ff00ff" ],
 [ -3.09017,        0, -8.09017,         -5,       -5,       -5,   1, "ff5555" ],


They should both run in what I am currently calling the "frame_designer" program. Just select all the code in either box (for some reason the "SELECT ALL" button doesn't work ... another thing on my "to do" list). Copy the code and paste it into the "JSON Line Segments" box in the frame designer page. Click the "Load from JSON" button and you should see the (almost) 3D image in the window.

I constructed the dodecahedron from the formula listed for the points at Wikipedia:

      https://en.wikipedia.org/wiki/Regular_dodecahedron

(±1, ±1, ±1)
(0, ±ϕ, ±1/ϕ)
(±1/ϕ, 0, ±ϕ)
(±ϕ, ±1/ϕ, 0)

where ϕ = (1 + √5)/2 is the golden ratio (also written τ) ≈ 1.618


But that just gave me the points. I still needed to connect line segments between the proper pairs of points to draw the figure. I originally did that by hand using the drawing tool, but it was very laborious. I drew small line segments at each point (so they could be seen), and I gave them different colors. Then, by hand, I made lines between those neighbors where it was needed. I used color to help me see which ones I was working on.

Tonight, I decided to write a program to do it automatically. I chose Python because it's easier to use from the command line than JavaScript. My program assumes that it's dealing with a regular polyhedron, so the lines will be drawn between the shortest distances between points. The algorithm proceeds as follows:

  1. Find the shortest non-zero distance between any pair of points.
  2. Set the threshold just above that shortest distance (to allow for digital misrepresentations).
  3. Define a line segment between any pair of points closer than that threshold.

Here's the Python code:

Code: Select all
# Generate coordinates for a dodecahedron
# https://en.wikipedia.org/wiki/Regular_dodecahedron

import math

s = 5
p = ( 1 + math.sqrt(5) ) / 2

# Build the list of points from the Wikipedia definitions

pt_list = []

for i in range(2):
  x = -1
  if i > 0: x = 1
  for j in range(2):
    y = -1
    if j > 0: y = 1
    for k in range(2):
      z = -1
      if k > 0: z = 1
      pt_list.append ( [x,y,z] )

for i in range(2):
  y = -p
  if i > 0: y = p
  for j in range(2):
    z = -(1/p)
    if j > 0: z = 1/p
    pt_list.append ( [0,y,z] )

for i in range(2):
  x = -(1/p)
  if i > 0: x = 1/p
  for j in range(2):
    z = -p
    if j > 0: z = p
    pt_list.append ( [x,0,z] )

for i in range(2):
  x = -p
  if i > 0: x = p
  for j in range(2):
    y = -(1/p)
    if j > 0: y = 1/p
    pt_list.append ( [x,y,0] )

# Get the maximum distance between all pairs of points
max_dist = 0.0
for i1 in range(len(pt_list)):
  p1 = pt_list[i1]
  for i2 in range(len(pt_list)):
    p2 = pt_list[i2]
    dx = p2[0] - p1[0]
    dy = p2[1] - p1[1]
    dz = p2[2] - p1[2]
    dist = math.sqrt((dx*dx)+(dy*dy)+(dz*dz))
    if dist > max_dist:
      max_dist = dist

# Get the minimum distance between all pairs of points
min_dist = max_dist
for i1 in range(len(pt_list)):
  for i2 in range(len(pt_list)):
    if i1 != i2:
      p1 = pt_list[i1]
      p2 = pt_list[i2]
      dx = p2[0] - p1[0]
      dy = p2[1] - p1[1]
      dz = p2[2] - p1[2]
      dist = math.sqrt((dx*dx)+(dy*dy)+(dz*dz))
      if dist < min_dist:
        min_dist = dist

# Set a threshold for neighbors (to allow for floating point inaccuracy)
t_dist = min_dist * 1.01

# Build an empty connection matrix
m = []
for i1 in range(len(pt_list)):
  n = []
  for i2 in range(len(pt_list)):
    n.append ( 0 )
  m.append ( n )

# Fill the matrix with connections under the threshold
tot = 0
for i1 in range(len(pt_list)):
  for i2 in range(len(pt_list)):
    if i1 != i2:
      p1 = pt_list[i1]
      p2 = pt_list[i2]
      dx = p2[0] - p1[0]
      dy = p2[1] - p1[1]
      dz = p2[2] - p1[2]
      dist = math.sqrt((dx*dx)+(dy*dy)+(dz*dz))
      if dist < t_dist:
        m[i1][i2] += 1
        tot += 1

# Print the lines from the upper triangular portion of the matrix
print ( "[" )
for i1 in range(len(pt_list)):
  for i2 in range(len(pt_list)):
    if i2 > i1:
      if m[i1][i2] > 0:
        pls = "["
        p = pt_list[i1]
        for c in range(len(p)):
          pls += str((s*p[c])) + ","
        p = pt_list[i2]
        for c in range(len(p)):
          pls += str((s*p[c])) + ","
        pls = ' ' + pls + '1,"00ff00"],'
        # pls = ' ' + pls[0:-1] + "]"
        print ( pls )
print ( "]" )

# Uncomment this to drop into a debugging shell
# __import__('code').interact(local={k: v for ns in (globals(), locals()) for k, v in ns.items()})


If you run that program from the command line, it will print out the JSON needed to draw the figure in the terminal window. I just selected that JSON from the terminal window and copied and pasted it into the frame designer program. This program produces all green output ("00ff00"), but you can change the colors by hand. And speaking of colors, one thing that I've found is that monochrome diagrams don't suffer from the lack of hidden line removal because you can't tell which line is behind the other anyway (all lines are the same color). And if you do use color, then using thinner lines makes it harder to perceive that the wrong line may be hidden. Here's an all green version:

Dodecahedron_Green_Spinning.gif
Dodecahedron_Green_Spinning.gif (561.61 KiB) Viewed 158 times


Here's an icosahedron (constructed similarly):

Icosahedron_Green_Spinning.gif
Icosahedron_Green_Spinning.gif (793.24 KiB) Viewed 157 times


Here's the formula listed for the icosahedron points at Wikipedia:

      https://en.wikipedia.org/wiki/Regular_icosahedron

(0, ±1, ±ϕ)
(±1, ±ϕ, 0)
(±ϕ, 0, ±1)

where ϕ = (1 + √5)/2 is the golden ratio (also written τ) ≈ 1.618


For completeness, here are the codes for all five of the platonic solids (tetrahedron, cube, octahedron, dodecahedron, and icosahedron):

Tetrahedron:
Code: Select all
[
 [-5,0,-3.53553390593,5,0,-3.53553390593,3,"00ff00"],
 [-5,0,-3.53553390593,0,-5,3.53553390593,3,"00ff00"],
 [-5,0,-3.53553390593,0,5,3.53553390593,3,"00ff00"],
 [5,0,-3.53553390593,0,-5,3.53553390593,3,"00ff00"],
 [5,0,-3.53553390593,0,5,3.53553390593,3,"00ff00"],
 [0,-5,3.53553390593,0,5,3.53553390593,3,"00ff00"],
]


Cube:
Code: Select all
[
 [-5,-5,-5,-5,-5,5,3,"00ff00"],
 [-5,-5,-5,-5,5,-5,3,"00ff00"],
 [-5,-5,-5,5,-5,-5,3,"00ff00"],
 [-5,-5,5,-5,5,5,3,"00ff00"],
 [-5,-5,5,5,-5,5,3,"00ff00"],
 [-5,5,-5,-5,5,5,3,"00ff00"],
 [-5,5,-5,5,5,-5,3,"00ff00"],
 [-5,5,5,5,5,5,3,"00ff00"],
 [5,-5,-5,5,-5,5,3,"00ff00"],
 [5,-5,-5,5,5,-5,3,"00ff00"],
 [5,-5,5,5,5,5,3,"00ff00"],
 [5,5,-5,5,5,5,3,"00ff00"],
]


Octahedron:
Code: Select all
[
 [-5,0,0,0,-5,0,3,"00ff00"],
 [-5,0,0,0,5,0,3,"00ff00"],
 [-5,0,0,0,0,-5,3,"00ff00"],
 [-5,0,0,0,0,5,3,"00ff00"],
 [5,0,0,0,-5,0,3,"00ff00"],
 [5,0,0,0,5,0,3,"00ff00"],
 [5,0,0,0,0,-5,3,"00ff00"],
 [5,0,0,0,0,5,3,"00ff00"],
 [0,-5,0,0,0,-5,3,"00ff00"],
 [0,-5,0,0,0,5,3,"00ff00"],
 [0,5,0,0,0,-5,3,"00ff00"],
 [0,5,0,0,0,5,3,"00ff00"],
]


Dodecahedron:
Code: Select all
[
 [        5,       -5,        5,    3.09017,        0,  8.09017,   1, "ff5555" ],
 [        0,  8.09017,  3.09017,          5,        5,        5,   1, "55ff55" ],
 [       -5,        5,        5,   -3.09017,        0,  8.09017,   1, "5555ff" ],
 [       -5,        5,        5,          0,  8.09017,  3.09017,   1, "ffff00" ],
 [  3.09017,        0,  8.09017,          5,        5,        5,   1, "ff00ff" ],
 [  3.09017,        0,  8.09017,   -3.09017,        0,  8.09017,   1, "55ffff" ],
 [        0,  8.09017,  3.09017,          0,  8.09017, -3.09017,   1, "ff5555" ],
 [ -3.09017,        0,  8.09017,         -5,       -5,        5,   1, "55ff55" ],
 [        5,        5,        5,    8.09017,  3.09017,        0,   1, "5555ff" ],
 [       -5,        5,        5,   -8.09017,  3.09017,        0,   1, "ff00ff" ],
 [        0, -8.09017,  3.09017,         -5,       -5,        5,   1, "5555ff" ],
 [       -5,       -5,        5,   -8.09017, -3.09017,        0,   1, "ffff00" ],
 [        0, -8.09017,  3.09017,          5,       -5,        5,   1, "ffff00" ],
 [        0, -8.09017, -3.09017,          0, -8.09017,  3.09017,   1, "ff00ff" ],
 [        5,       -5,        5,    8.09017, -3.09017,        0,   1, "55ff55" ],
 [  8.09017, -3.09017,        0,    8.09017,  3.09017,        0,   1, "55ffff" ],
 [  8.09017, -3.09017,        0,    8.09017,  3.09017,        0,   1, "ffff00" ],
 [  8.09017,  3.09017,        0,          5,        5,       -5,   1, "ff00ff" ],
 [        0,  8.09017, -3.09017,          5,        5,       -5,   1, "55ffff" ],
 [        5,        5,       -5,    3.09017,        0, -8.09017,   1, "ff5555" ],
 [  8.09017, -3.09017,        0,          5,       -5,       -5,   1, "5555ff" ],
 [ -8.09017, -3.09017,        0,   -8.09017,  3.09017,        0,   1, "ff5555" ],
 [ -8.09017,  3.09017,        0,         -5,        5,       -5,   1, "55ff55" ],
 [       -5,        5,       -5,          0,  8.09017, -3.09017,   1, "5555ff" ],
 [        5,       -5,       -5,          0, -8.09017, -3.09017,   1, "ff5555" ],
 [       -5,       -5,       -5,   -8.09017, -3.09017,        0,   1, "55ffff" ],
 [       -5,       -5,       -5,   -8.09017, -3.09017,        0,   1, "55ffff" ],
 [       -5,        5,       -5,   -3.09017,        0, -8.09017,   1, "ffff00" ],
 [        5,       -5,       -5,    3.09017,        0, -8.09017,   1, "55ff55" ],
 [        0, -8.09017, -3.09017,         -5,       -5,       -5,   1, "5555ff" ],
 [  3.09017,        0, -8.09017,   -3.09017,        0, -8.09017,   1, "ff00ff" ],
 [ -3.09017,        0, -8.09017,         -5,       -5,       -5,   1, "ff5555" ],
]


Icosahedron:
Code: Select all
[
 [0,-5,-8.09016994375,0,5,-8.09016994375,3,"00ff00"],
 [0,-5,-8.09016994375,-5,-8.09016994375,0,3,"00ff00"],
 [0,-5,-8.09016994375,5,-8.09016994375,0,3,"00ff00"],
 [0,-5,-8.09016994375,-8.09016994375,0,-5,3,"00ff00"],
 [0,-5,-8.09016994375,8.09016994375,0,-5,3,"00ff00"],
 [0,-5,8.09016994375,0,5,8.09016994375,3,"00ff00"],
 [0,-5,8.09016994375,-5,-8.09016994375,0,3,"00ff00"],
 [0,-5,8.09016994375,5,-8.09016994375,0,3,"00ff00"],
 [0,-5,8.09016994375,-8.09016994375,0,5,3,"00ff00"],
 [0,-5,8.09016994375,8.09016994375,0,5,3,"00ff00"],
 [0,5,-8.09016994375,-5,8.09016994375,0,3,"00ff00"],
 [0,5,-8.09016994375,5,8.09016994375,0,3,"00ff00"],
 [0,5,-8.09016994375,-8.09016994375,0,-5,3,"00ff00"],
 [0,5,-8.09016994375,8.09016994375,0,-5,3,"00ff00"],
 [0,5,8.09016994375,-5,8.09016994375,0,3,"00ff00"],
 [0,5,8.09016994375,5,8.09016994375,0,3,"00ff00"],
 [0,5,8.09016994375,-8.09016994375,0,5,3,"00ff00"],
 [0,5,8.09016994375,8.09016994375,0,5,3,"00ff00"],
 [-5,-8.09016994375,0,5,-8.09016994375,0,3,"00ff00"],
 [-5,-8.09016994375,0,-8.09016994375,0,-5,3,"00ff00"],
 [-5,-8.09016994375,0,-8.09016994375,0,5,3,"00ff00"],
 [-5,8.09016994375,0,5,8.09016994375,0,3,"00ff00"],
 [-5,8.09016994375,0,-8.09016994375,0,-5,3,"00ff00"],
 [-5,8.09016994375,0,-8.09016994375,0,5,3,"00ff00"],
 [5,-8.09016994375,0,8.09016994375,0,-5,3,"00ff00"],
 [5,-8.09016994375,0,8.09016994375,0,5,3,"00ff00"],
 [5,8.09016994375,0,8.09016994375,0,-5,3,"00ff00"],
 [5,8.09016994375,0,8.09016994375,0,5,3,"00ff00"],
 [-8.09016994375,0,-5,-8.09016994375,0,5,3,"00ff00"],
 [8.09016994375,0,-5,8.09016994375,0,5,3,"00ff00"],
]
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7792
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Previous
Forum Statistics

Who is online

Users browsing this forum: No registered users and 1 guest

Options

Return to Technology Forum