mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-05 22:37:35 +02:00
updated polysections
This commit is contained in:
@@ -14,26 +14,14 @@ You can also view it as a better polyline3d module if you want. If you have only
|
|||||||
|
|
||||||
When using this module, you should use points to represent each cross-section.
|
When using this module, you should use points to represent each cross-section.
|
||||||
|
|
||||||
You need to provide indexes of triangles, too. This module provides three prepared triangles indexes. One is `"RADIAL"`. For example, if you have a cross-section such as:
|
If your 2D shape is not solid, indexes of triangles are required. This module has a built-in index vector suitable for one type of hollow shapes. For example, if you have a cross-section such as:
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
When using `"RADIAL"` (default), the module will cut them into triangles from the first point to each remaining point:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If your cross-sections are hollow, you may use `"HOLLOW"`. For example:
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
When using `"HOLLOW"`, the above shape will be cut into triangles such as:
|
When `triangles` is `"HOLLOW"`, the above shape will be cut into triangles such as:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
When using `"TAPE"`, a tape shape will be cut into triangles such as:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You can cut triangles by yourself, for example, the indexes of the above triangles is:
|
You can cut triangles by yourself, for example, the indexes of the above triangles is:
|
||||||
|
|
||||||
[
|
[
|
||||||
@@ -50,7 +38,7 @@ Triangles may be defined in any order.
|
|||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `sections` : A list of cross-sections. Each cross-section is represented by a list of points. See the example below.
|
- `sections` : A list of cross-sections. Each cross-section is represented by a list of points. See the example below.
|
||||||
- `triangles` : `"RADIAL"` (default), `"HOLLOW"`, `"TAPE"` or user-defined indexes. See example below.
|
- `triangles` : `"SOLID"` (default), `"HOLLOW"`, or user-defined indexes. See example below.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@@ -11,10 +11,9 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__triangles_radial.scad>;
|
|
||||||
include <__private__/__triangles_tape.scad>;
|
include <__private__/__triangles_tape.scad>;
|
||||||
|
|
||||||
module polysections(sections, triangles) {
|
module polysections(sections, triangles = "SOLID") {
|
||||||
module solid_sections() {
|
module solid_sections() {
|
||||||
leng_sections = len(sections);
|
leng_sections = len(sections);
|
||||||
leng_pts_section = len(sections[0]);
|
leng_pts_section = len(sections[0]);
|
||||||
@@ -80,12 +79,8 @@ module polysections(sections, triangles) {
|
|||||||
)
|
)
|
||||||
) idxes;
|
) idxes;
|
||||||
|
|
||||||
function tris() = triangles == "RADIAL" ? __triangles_radial(sections[0]) :
|
function tris() =
|
||||||
(
|
triangles == "HOLLOW" ? hollow_tris() : triangles;
|
||||||
triangles == "HOLLOW" ? hollow_tris() : (
|
|
||||||
triangles == "TAPE" ? __triangles_tape(sections[0]) : triangles
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
module two_sections(section1, section2) {
|
module two_sections(section1, section2) {
|
||||||
for(idx = tris()) {
|
for(idx = tris()) {
|
||||||
@@ -114,7 +109,7 @@ module polysections(sections, triangles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if(triangles == undef) {
|
if(triangles == "SOLID") {
|
||||||
solid_sections();
|
solid_sections();
|
||||||
} else {
|
} else {
|
||||||
triangles_defined_sections();
|
triangles_defined_sections();
|
||||||
|
Reference in New Issue
Block a user