mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
doc fixes
This commit is contained in:
parent
c98dc64d20
commit
6de156528b
2 changed files with 13 additions and 9 deletions
|
@ -1405,8 +1405,9 @@ function polygon_area(poly, signed=false) =
|
||||||
|
|
||||||
// Function: centroid()
|
// Function: centroid()
|
||||||
// Usage:
|
// Usage:
|
||||||
// c = centroid(object);
|
// c = centroid(object, [eps]);
|
||||||
// Topics: Geometry, Polygons, Centroid
|
// Topics: Geometry, Polygons, Centroid
|
||||||
|
// Description:
|
||||||
// Given a simple 2D polygon, returns the 2D coordinates of the polygon's centroid.
|
// Given a simple 2D polygon, returns the 2D coordinates of the polygon's centroid.
|
||||||
// Given a simple 3D planar polygon, returns the 3D coordinates of the polygon's centroid.
|
// Given a simple 3D planar polygon, returns the 3D coordinates of the polygon's centroid.
|
||||||
// If you provide a non-planar or collinear polygon you will get an error. For self-intersecting
|
// If you provide a non-planar or collinear polygon you will get an error. For self-intersecting
|
||||||
|
@ -1415,6 +1416,9 @@ function polygon_area(poly, signed=false) =
|
||||||
// If object is a manifold VNF then returns the 3d centroid of the polyhedron. The VNF must
|
// If object is a manifold VNF then returns the 3d centroid of the polyhedron. The VNF must
|
||||||
// describe a valid polyhedron with consistent face direction and no holes in the mesh; otherwise
|
// describe a valid polyhedron with consistent face direction and no holes in the mesh; otherwise
|
||||||
// the results are undefined.
|
// the results are undefined.
|
||||||
|
// Arguments:
|
||||||
|
// object = object to compute the centroid of
|
||||||
|
// eps = epsilon value for identifying degenerate cases
|
||||||
function centroid(object,eps=EPSILON) =
|
function centroid(object,eps=EPSILON) =
|
||||||
assert(is_finite(eps) && (eps>=0), "The tolerance should a non-negative value." )
|
assert(is_finite(eps) && (eps>=0), "The tolerance should a non-negative value." )
|
||||||
is_vnf(object) ? _vnf_centroid(object,eps)
|
is_vnf(object) ? _vnf_centroid(object,eps)
|
||||||
|
@ -1423,8 +1427,8 @@ function centroid(object,eps=EPSILON) =
|
||||||
: assert(false, "Input must be a VNF, a region, or a 2D or 3D polygon");
|
: assert(false, "Input must be a VNF, a region, or a 2D or 3D polygon");
|
||||||
|
|
||||||
|
|
||||||
// Internal Function: _region_centroid()
|
/// Internal Function: _region_centroid()
|
||||||
// Compute centroid of region
|
/// Compute centroid of region
|
||||||
function _region_centroid(region,eps=EPSILON) =
|
function _region_centroid(region,eps=EPSILON) =
|
||||||
let(
|
let(
|
||||||
region=force_region(region),
|
region=force_region(region),
|
||||||
|
@ -1668,21 +1672,21 @@ function point_in_polygon(point, poly, nonzero=false, eps=EPSILON) =
|
||||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||||
// color("black") up(3) vnf_debug([poly,[]],faces=false,size=1);
|
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||||
// Example(2D,NoAxes): a polygon with a hole and one "contact" edge
|
// Example(2D,NoAxes): a polygon with a hole and one "contact" edge
|
||||||
// poly = [ [-10,0], [10,0], [0,10], [-10,0], [-4,4], [4,4], [0,2], [-4,4] ];
|
// poly = [ [-10,0], [10,0], [0,10], [-10,0], [-4,4], [4,4], [0,2], [-4,4] ];
|
||||||
// tris = polygon_triangulate(poly);
|
// tris = polygon_triangulate(poly);
|
||||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||||
// color("black") up(3) vnf_debug([poly,[]],faces=false,size=1);
|
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||||
// Example(2D,NoAxes): a polygon with "touching" vertices and no holes
|
// Example(2D,NoAxes): a polygon with "touching" vertices and no holes
|
||||||
// poly = [ [0,0], [5,5], [-5,5], [0,0], [-5,-5], [5,-5] ];
|
// poly = [ [0,0], [5,5], [-5,5], [0,0], [-5,-5], [5,-5] ];
|
||||||
// tris = polygon_triangulate(poly);
|
// tris = polygon_triangulate(poly);
|
||||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||||
// color("black") up(3) vnf_debug([poly,[]],faces=false,size=1);
|
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||||
// Example(2D,NoAxes): a polygon with "contact" edges and no holes
|
// Example(2D,NoAxes): a polygon with "contact" edges and no holes
|
||||||
// poly = [ [0,0], [10,0], [10,10], [0,10], [0,0], [3,3], [7,3],
|
// poly = [ [0,0], [10,0], [10,10], [0,10], [0,0], [3,3], [7,3],
|
||||||
// [7,7], [7,3], [3,3] ];
|
// [7,7], [7,3], [3,3] ];
|
||||||
|
@ -1690,7 +1694,7 @@ function point_in_polygon(point, poly, nonzero=false, eps=EPSILON) =
|
||||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||||
// color("black") up(3) vnf_debug([poly,[]],faces=false,size=1);
|
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||||
// Example(3D):
|
// Example(3D):
|
||||||
// include <BOSL2/polyhedra.scad>
|
// include <BOSL2/polyhedra.scad>
|
||||||
// vnf = regular_polyhedron_info(name="dodecahedron",side=5,info="vnf");
|
// vnf = regular_polyhedron_info(name="dodecahedron",side=5,info="vnf");
|
||||||
|
|
|
@ -93,8 +93,8 @@ function _is_cw(a,b,c,all) =
|
||||||
// Returns a path as a list of indices into `points`.
|
// Returns a path as a list of indices into `points`.
|
||||||
// When all==true, returns extra points that are on edges of the hull.
|
// When all==true, returns extra points that are on edges of the hull.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// points - list of 2d points to get the hull of.
|
// points = list of 2d points to get the hull of.
|
||||||
// all - when true, includes all points on the edges of the convex hull. Default: false.
|
// all = when true, includes all points on the edges of the convex hull. Default: false.
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// pts = [[-10,-10], [0,10], [10,10], [12,-10]];
|
// pts = [[-10,-10], [0,10], [10,10], [12,-10]];
|
||||||
// path = hull2d_path(pts);
|
// path = hull2d_path(pts);
|
||||||
|
|
Loading…
Reference in a new issue