revarbat / BOSL

The Belfry OpenScad Library - A library of tools, shapes, and helpers to make OpenScad easier to use.
https://github.com/revarbat/BOSL/wiki
BSD 2-Clause "Simplified" License
542 stars 62 forks source link

Add libfile for regular polyhedrons #16

Closed revarbat closed 5 years ago

revarbat commented 5 years ago

As per suggestion from @adrianVmariano, We should have a regular solids libfile. At the least for the platonic solids, and typical dice polyhedra: 4, 6, 8, 10, 12, 20, 30 sides. Maybe some of the Archimedean solids.

revarbat commented 5 years ago

The block names are not arbitrary. Side Effects: is one of the optional standard block names.

revarbat commented 5 years ago

Really, only the Module/Function and Description are required.

revarbat commented 5 years ago

If you have a line as just a comment with three trailing spaces //, I believe it will render as a paragraph break.

Maybe.

If it doesn’t work, I’ll fix it.

adrianVmariano commented 5 years ago

I was just thinking about how to restructure my current documentation, where I have different sections for how to select a solid, choosing size, choosing orientation, and so on, with embedded (textual) examples. I was thinking about having all of this stuff in the Description section vs having separate sections "Selecting a Polyhedron", "Specfiying Polyhedron Size" and so on.

revarbat commented 5 years ago

Remember, you can use markdown syntax in the description to have subsections. I’ll look into arbitrary blocks though.

revarbat commented 5 years ago

More complete docs formatting explanation at: https://github.com/revarbat/BOSL/blob/master/WRITING_DOCS.md

revarbat commented 5 years ago

I've added PHI to math.scad.

revarbat commented 5 years ago

Finally ran the latest polyhedra demo you sent. Verrrrry nice. Good job!

revarbat commented 5 years ago

BTW, the Display of all solids with insphere, midsphere and circumsphere demo now times at 27 seconds on my weak-sauce laptop.

adrianVmariano commented 5 years ago

The run time was slower than I expected, as I thought I had it at 6s. I started fiddling and got it down to 6s on my machine (from 13s originally) but some of the optimizations seemed odd. So I tried changing

use<BOSL/math.scad>

to

include<BOSL/math.scad>

and my run time went to 4s. Now I'm wondering if the optimizations were all just minimizing the number of library function calls. What does your run time do if you make that change?

Now I wonder if use has some other secret overhead.

revarbat commented 5 years ago

I've committed the hull() functions in convex_hull.scad. The three main functions are convex_hull2d(), convex_hull3d(), and convex_hull()

revarbat commented 5 years ago

Also, a number of functions added to math.scad.

revarbat commented 5 years ago

Good work, @adrianVmariano! I've just committed this into BOSL2.