Author Topic: Algorithm: Draw ball  (Read 9122 times)

0 Members and 1 Guest are viewing this topic.

well20152016

  • Newt
  • Posts: 130
Algorithm: Draw ball
« on: April 06, 2019, 10:56:09 PM »
Known: 1. Radius of the sphere
             2. Side Length of Hexagon or Pentagon (Approximate Value)

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #1 on: April 07, 2019, 12:26:24 AM »
If you want lisp, you should firstly analyze construction - it's called truncated icosahedron...
Here is my video with construction :
https://www.youtube.com/watch?v=V0D6XcjeoQA

HTH., M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #2 on: April 07, 2019, 10:03:49 AM »

Thank you! It's just a situation! I wonder if LISP can handle more situations?

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: Algorithm: Draw ball
« Reply #3 on: April 07, 2019, 09:11:30 PM »
If you can work out the maths then theorecticaly anything is possible. There is a mathmatical theorem for the soccer ball.
A man who never made a mistake never made anything

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #4 on: April 08, 2019, 01:05:15 AM »
The surface of a football ball ball ball is a sphere made up of 12 regular pentagons and 20 regular hexagons.

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #5 on: April 09, 2019, 05:50:05 AM »
dwg

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #6 on: April 09, 2019, 09:39:17 AM »
You generated different ball then I was expecting... It's not based on truncated icosahedron... I tried to get 3DSOLID, but some lines aren't touching exactly with each others and beside all this, to make 3DSOLID those lines have to make exact planar polygons - sorry it was close - my routine recognized some polygons and converted them to regions, but major of them were not processed, so final surfsculpt was not good...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #7 on: April 10, 2019, 10:19:22 AM »
All I found was this :
https://patents.google.com/patent/US3696566

It's sphere constructed of 12 regular pentagons and 60 irregular hexagons... There are variants with 12 pentagons and 200 hexagons and 12 pentagons and 620 hexagons... Pentagon centers are positioned always at vertices of corresponding regular icosahedron...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #8 on: April 10, 2019, 10:38:12 AM »
There is also this picture - extended dodecahedra...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #9 on: April 10, 2019, 06:18:37 PM »
Thank you. I'm studying, too.

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #10 on: April 12, 2019, 09:34:51 AM »
It's sphere constructed of 11 regular pentagons and 80 irregular hexagons.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #11 on: April 12, 2019, 10:33:18 AM »
Well it's almost the same as your first example... I would say 12 regular pentagons and 80 irregular hexagons... I guess I counted wrong - thought 60 hexagons... But the same - no success in converting 3d lines to 3d solid... Only pentagons were good, but then again I think that not all were processed - not even single hexagon is good - you have to check their planar characteristics... Still not perfect...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #12 on: April 12, 2019, 12:21:07 PM »
Are there any programs that can automatically generate sphere boxes?

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #13 on: April 12, 2019, 01:05:51 PM »
Look I've counted your last example - it seems 12 regular pentagons and 110 irregular hexagons... I'll attach my counted version - you can check if you want...
To answer your question : there are lisps for geodesic spheres and also there are lisps for all kind of dense covered spheres with regular triangles, quads, pentagons and hexagons based on uniform polyhedrons...
M.R.
« Last Edit: April 13, 2019, 07:46:24 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #14 on: April 14, 2019, 04:38:12 AM »
Here is my version of the same ball - 12 pentagons + 110 hexagons... I constructed based on dodecahedron - the problem still exist - we don't know ratio : edge of pentagon/hexagon : radius of sphere... I almost did it visually, but then the problem occurred when 2 cups had to be connected (bottom and top cup)... It seems that edge of pentagon should be little bigger, but we don't know how to determine that accurately...

Regards, M.R.

[EDIT : DWG removed due to lack of interest - not even single download up to now... See date of edit below post...]
« Last Edit: April 15, 2019, 12:17:12 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #15 on: April 14, 2019, 10:07:13 AM »
Here, I scaled pentagons with help of small routine, but the best I could get is 220 trapezoids instead of haxagons to finally make 3DSOLID... It looks very difficult to make it from real planar haxagons...

[EDIT : DWG removed due to lack of interest - not even single download up to now... See date of edit below post...]
« Last Edit: April 15, 2019, 04:50:30 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #16 on: April 14, 2019, 11:43:20 AM »
What I meant to say 12 regular pentagons, 20 irregular hexagons and 180 trapezoids...

(You are my density... What I meant to say, my destiny...)
Where did I hear this, I wonder...
M.R.
 8-)
« Last Edit: April 16, 2019, 06:37:54 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #17 on: April 16, 2019, 09:04:05 AM »
For ruggby, american football... Just joking...
 :2funny:
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Algorithm: Draw ball
« Reply #18 on: April 17, 2019, 07:54:32 AM »
Very cool stuff. :)
TheSwamp.org  (serving the CAD community since 2003)

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #19 on: April 17, 2019, 07:59:28 AM »
Very cool stuff. :)

I haven't checked video, but I made presentation of redesign of soccer ball...
https://youtu.be/a8uUK7-N1iU

Of course, thanks for pushing me to do it... @well20152016 was the one that deserves gratitude too...

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #20 on: April 19, 2019, 08:11:56 AM »
Another video, now 3D MODEL of HOUSE based on SOCCER BALL design... Don't quite know for materials, but all faces are planar, so it could be from glass or something flat... It could be very simple, but could be also with larger scales...

https://youtu.be/lf0aIs_lnWo

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Algorithm: Draw ball
« Reply #21 on: April 21, 2019, 10:25:41 AM »
This polyhedron has 12 pentagons and 50 quads+triangles... I don't know how Langner sphere is constructed with 12 pentagons and 60 hexagons - this must be some kind of magic I can't imagine...

https://www.google.com/search?client=firefox-b-d&q=small+rhombicosidodecahedron
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #22 on: April 22, 2019, 08:16:03 PM »
thank!

well20152016

  • Newt
  • Posts: 130
Re: Algorithm: Draw ball
« Reply #23 on: January 16, 2020, 09:15:55 AM »
Can LISP automatically generate such a sphere?

ahsattarian

  • Newt
  • Posts: 112
Re: Algorithm: Draw ball
« Reply #24 on: November 25, 2020, 11:15:36 PM »
Not Exactly what u need , but may be useful :




Code - Auto/Visual Lisp: [Select]
  1. (defun c:sphereface ()
  2.   (setvar "osmode" 0)
  3.   (initget (+ 1 16))
  4.   (setq cen (getpoint "\n Centre : "))
  5.   (setvar "autosnap" 39)
  6.   (setvar "orthomode" 1)
  7.   (initget (+ 1 16))
  8.   (setq pt (getpoint "\n Radius : " cen))
  9.   (setq rad (distance cen pt))
  10.   (setq num1 30)
  11.   (setq num2 20)
  12.   (setvar "thickness" 0.0)
  13.   (setq i -1)
  14.   (repeat num2
  15.     (setq i (1+ i))
  16.     (setq ang1 (* (* pi 0.5) (/ (float i) (float num2))))
  17.     (setq rad1 (* (sin ang1) rad))
  18.     (setq h1 (sqrt (- (* rad rad) (* rad1 rad1))))
  19.     (setq ang2 (* (* pi 0.5) (/ (float (1+ i)) (float num2))))
  20.     (setq rad2 (* (sin ang2) rad))
  21.     (setq h2 (sqrt (- (* rad rad) (* rad2 rad2))))
  22.     (if (= rad1 0.0)
  23.       (progn
  24.         (setq pt2 (polar cen 0.0 rad2))
  25.         (setq pt3 (polar cen (/ (* pi 2.0) num1) rad2))
  26.         (setq p1 (list (car cen) (cadr cen) (- (caddr cen) h1)))
  27.         (setq p2 (list (car pt2) (cadr pt2) (- (caddr cen) h2)))
  28.         (setq p3 (list (car pt3) (cadr pt3) (- (caddr cen) h2)))
  29.         (command "3dface" p1 p2 p3 "" "")
  30.       )
  31.       (progn
  32.         (setq pt1 (polar cen 0.0 rad1))
  33.         (setq pt2 (polar cen 0.0 rad2))
  34.         (setq pt3 (polar cen (/ (* pi 2.0) num1) rad1))
  35.         (setq pt4 (polar cen (/ (* pi 2.0) num1) rad2))
  36.         (setq p1 (list (car pt1) (cadr pt1) (- (caddr cen) h1)))
  37.         (setq p2 (list (car pt2) (cadr pt2) (- (caddr cen) h2)))
  38.         (setq p3 (list (car pt3) (cadr pt3) (- (caddr cen) h1)))
  39.         (setq p4 (list (car pt4) (cadr pt4) (- (caddr cen) h2)))
  40.         (command "3dface" p1 p2 p4 p3 "")
  41.       )
  42.     )
  43.     (command "array" "last" "" "polar" cen num1 360.0 "")
  44.   )
  45. )





d2010

  • Bull Frog
  • Posts: 326
Re: Algorithm: Draw ball
« Reply #25 on: December 04, 2020, 07:19:21 AM »
Can LISP automatically generate such a sphere?
I reverse of code-source.
Code - Auto/Visual Lisp: [Select]
  1. (setq jc_getstatic10 nil setmypid "https://youtu.be/4TIZNNluHE0?t=198" getmypid nil)
  2. (if (car (atoms-family 1 '("vl-load-com"))) (progn (vl-load-com) (prompt "\n\n")))
  3. (defun jc_aro10(mypid loopwne / rom j_jsr lpt eer)
  4.    (setq rom nil lpt nil setmypid (substr mypid 1 4) j_jsr (substr mypid 5 255))
  5. ;;ByA=kpblc@theswamp.com
  6.  (setq rom (vl-catch-all-apply (read j_jsr) loopwne))
  7.      (setq lpt (list "\n**T349errorA= " setmypid "->" j_jsr "{" (vl-catch-all-error-message rom) "}"))
  8.      (setq getmypid (cons setmypid getmypid))
  9.    ) ;_ end of if
  10.  (if (/= lpt nil) (foreach plt lpt (princ plt)))
  11.  (if (/= lpt nil) (setq jc_getstatic10 (cddr lpt)))
  12. rom)
  13. ;;{$R dfn_cad_amain2}
  14.  
  15. (Defun C:q2()
  16.   (setq;|a893|;
  17.          dfn_pp_v1chkR nil)  
  18.   (gheorghe_hagi_ballon_app)
  19. )
  20.  
  21. (Defun asserte(mssg / $rr)
  22.   (setq;|a1490|;
  23.          acad__assertNo (+ acad__assertNo 1)) (if (/= mssg nil) (setq;|a1532|;
  24.          erprv erlsp
  25.          erlsp mssg))
  26. erlsp)
  27.  
  28. (Prompt "\nCommand.com=Q2[enter]\n")
  29. (Defun gheorghe_hagi_ballon_app( / )
  30.    (setq acad__assertNo 0)
  31.  
  32.  ;;{$R (call_stas)}
  33. ;------------------------Stdcall pp_ahsattarian
  34.   (setq _ax (pp_ahsattarian ))
  35. ;------------------------
  36.  ;;{$R dfn_cad_amain_callend2}
  37.  
  38.   (princ "\nEnd")  
  39. T)
  40. ;(User Labels)
  41. ;(pp_ahsattarian)
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  ;;{$R pp_ahsattarian}
  49.  
  50. (defun pp_ahsattarian( / $rr nop dyn j_lastore pcr pcm psd j_ldc)
  51.   (gc) (setq;|a14980|;
  52.          j_ldc "cecolor") (jc_aro10 "C001setvar" (list  "osmode" 0)) (jc_aro10 "C002initget" (list  (+ 1 16))) (setq;|a15034|;
  53.          cen (jc_aro10 "C003getpoint" (list  "\n centre : "))) (jc_aro10 "C004setvar" (list  "autosnap" 39)) (jc_aro10 "C005setvar" (list  "orthomode" 1)) (jc_aro10 "C006initget" (list  (+ 1 16))) (setq;|a15116|;
  54.          pt (jc_aro10 "C007getpoint" (list  "\n radius : " cen))) (setq;|a15148|;
  55.          rad (jc_aro10 "C008distance" (list  cen pt))) (setq;|a15180|;
  56.          num1 30) (setq;|a15196|;
  57.          num2 20) (jc_aro10 "C009setvar" (list  "thickness" 0.0)) (setq;|a15232|;
  58.          pcr (jc_aro10 "C010getint" (list  "\nstartcolorindex[1..100]"))) (setq;|a15268|;
  59.          pcr (if (=  pcr nil) 1 (abs pcr))
  60.          pcr (if (=  pcr 0) 7 pcr)
  61.          pcr (if (>  pcr 100) 100 pcr)
  62.          pcm (jc_aro10 "C011getint" (list  "\nstopcolorindex[100..253]"))) (setq;|a15410|;
  63.          pcm (if (=  pcm nil) 1 (abs pcm))
  64.          pcm (if (<= pcm pcr) 191 (boole 1  pcm 255))
  65.          psd pcr) (jc_aro10 "C012setvar" (list  j_ldc (itoa psd))) (jc_aro10 "C013con_kpi" (list )) (progn (setq;|a15542|;
  66.          i (- 1)) (while (>= num2 0) (progn  (setq;|a15592|;
  67.          i (+ i 1)
  68.          ang1 (* kpi 0.5 (/ (float i) (float num2)))
  69.          rad1 (* (sin ang1) rad)
  70.          h1 (sqrt (- (* rad rad) (* rad1 rad1)))
  71.          ang2 (* kpi 0.5 (/ (float (+ i 1)) (float num2)))
  72.          rad2 (* (sin ang2) rad)
  73.          h2 (sqrt (- (* rad rad) (* rad2 rad2)))) (if (=  rad1 0.0) (setq;|a15854|;
  74.          pt2 (jc_aro10 "C014polar" (list  cen 0.0 rad2))
  75.          pt3 (jc_aro10 "C015polar" (list  cen (/ (* kpi 2.0) num1) rad2))
  76.          p1 (list (car cen) (jc_aro10 "C016cadr" (list  cen)) (- (jc_aro10 "C017caddr" (list  cen)) h1))
  77.          p2 (list (car pt2) (jc_aro10 "C018cadr" (list  pt2)) (- (jc_aro10 "C019caddr" (list  cen)) h2))
  78.          p3 (list (car pt3) (jc_aro10 "C020cadr" (list  pt3)) (- (jc_aro10 "C021caddr" (list  cen)) h2))
  79.          nop (command "3dface" p1 p2 p3 "" "")) (setq;|a16264|;
  80.          pt1 (jc_aro10 "C022polar" (list  cen 0.0 rad1))
  81.          pt2 (jc_aro10 "C023polar" (list  cen 0.0 rad2))
  82.          pt3 (jc_aro10 "C024polar" (list  cen (/ (* kpi 2.0) num1) rad1))
  83.          pt4 (jc_aro10 "C025polar" (list  cen (/ (* kpi 2.0) num1) rad2))
  84.          p1 (list (car pt1) (jc_aro10 "C026cadr" (list  pt1)) (- (jc_aro10 "C027caddr" (list  cen)) h1))
  85.          p2 (list (car pt2) (jc_aro10 "C028cadr" (list  pt2)) (- (jc_aro10 "C029caddr" (list  cen)) h2))
  86.          p3 (list (car pt3) (jc_aro10 "C030cadr" (list  pt3)) (- (jc_aro10 "C031caddr" (list  cen)) h1))
  87.          p4 (list (car pt4) (jc_aro10 "C032cadr" (list  pt4)) (- (jc_aro10 "C033caddr" (list  cen)) h2))
  88.          psd (+ psd 1)
  89.          psd (if (>  psd pcm) pcr psd)
  90.          nop (jc_aro10 "C034setvar" (list  j_ldc (itoa psd)))
  91.          nop (command "3dface" p1 p2 p4 p3 ""))) (command "array" "last" "" "polar" cen num1 360.0 "")) (setq;|a16954|;
  92.          num2 (- num2 1))))
  93. $rr)
  94.  
  95.  
  96. ;L
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  ;;{$R con_kpi}
  110.  
  111. (defun con_kpi(/ )
  112.   (setq;|a21010|;
  113.          kpi 3.14159265358979323846
  114.          kHalfPi 1.57079632679489661923
  115.          kTwoPi 6.28318530717958647692
  116.          kpi_max 3.14159265358979323846264338327950288
  117.          con_kpi kpi
  118.          con_kpi2 6.2831853071795865
  119.          con_khalfpi (/ pi 2.0)
  120.          con_k1pi4 (* pi 0.25)
  121.          con_k3pi4 (* pi 0.75)
  122.          con_k5pi4 (* pi 1.25)
  123.          con_k7pi4 (* pi 1.75)
  124.          kpi_mul3 9.42477796076937971538793014984
  125.          kpi_mul4 12.56637061435917
  126.          con_k2mulpi 6.28318530717958647692
  127.          con_k2divpi 0.63661977236758134308
  128.          con_ksqrt2 1.41421356237309504880
  129.          con_k1divsqrt2 0.70710678118654752440
  130.          con_k1six 0.16666666666666666667
  131.          con_k1three (* con_k1six 2.0)
  132.          con_k2divsqrt_pi 1.12837916709551257390
  133.          kpi_div2 1.57079632679489661923
  134.          kpi_inv1 0.31830988618379067154
  135.          kpi_div3 1.04719755119659774615421446109
  136.          kpi_div4 7.8539816339744830962E-1
  137.          kpi_sqrt2 1.1283791670955125739E+0
  138.          con_keps 1.05367121277235079465e-8
  139.          kpi_2div3 2.09439510239319549230842892218
  140.          kpi_5div6 2.61799387799149436538553615272
  141.          kRad0 0.0
  142.          kRad45 (/ 3.14159265358979323846 4.0)
  143.          kRad90 (/ 3.14159265358979323846 2.0)
  144.          kRad135 (/ (* 3.14159265358979323846 3.0) 4.0)
  145.          kRad180 3.14159265358979323846
  146.          kRad270 (* 3.14159265358979323846 1.5)
  147.          kRad360 (* 3.14159265358979323846 2.0))
  148. )
  149. ;{$R coff_linkerarx}
  150.  
« Last Edit: December 11, 2020, 02:59:48 AM by d2010 »