Skip to content

Commit a07306a

Browse files
authored
Merge pull request BelfrySCAD#1985 from BelfrySCAD/revarbat_dev
2 parents c5d45dc + d67af9c commit a07306a

1 file changed

Lines changed: 140 additions & 141 deletions

File tree

vnf.scad

Lines changed: 140 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -136,146 +136,6 @@ EMPTY_VNF = [[],[]]; // The standard empty VNF with no vertices or faces.
136136
// "intersect" = Anchors to the surface of the shape.
137137
// Named Anchors:
138138
// "origin" = Anchor at the origin, oriented UP.
139-
// Example(3D): Triangulating using `style="default"`. Triangulates the same direction for every quad.
140-
// module show_triangulation(fn, style, steps) {
141-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
142-
// vnf = vnf_vertex_array(pts, style=style);
143-
// grid_vnf = vnf_vertex_array(pts, style="quad");
144-
// color("#ccf") vnf_polyhedron(vnf);
145-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
146-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
147-
// txt = str("style = ", style);
148-
// move([50,0,-20]) rot($vpr) color("black")
149-
// text(txt, size=5, halign="center", valign="top");
150-
// }
151-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
152-
// show_triangulation(fn, "default", steps=4);
153-
// Example(3D): Triangulating using `style="alt"`. The opposite triangulation from "default".
154-
// module show_triangulation(fn, style, steps) {
155-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
156-
// vnf = vnf_vertex_array(pts, style=style);
157-
// grid_vnf = vnf_vertex_array(pts, style="quad");
158-
// color("#ccf") vnf_polyhedron(vnf);
159-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
160-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
161-
// txt = str("style = ", style);
162-
// move([50,0,-20]) rot($vpr) color("black")
163-
// text(txt, size=5, halign="center", valign="top");
164-
// }
165-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
166-
// show_triangulation(fn, "alt", steps=4);
167-
// Example(3D): Triangulating using `style="flip1"`. Alternates triangulation direction in a grid.
168-
// module show_triangulation(fn, style, steps) {
169-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
170-
// vnf = vnf_vertex_array(pts, style=style);
171-
// grid_vnf = vnf_vertex_array(pts, style="quad");
172-
// color("#ccf") vnf_polyhedron(vnf);
173-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
174-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
175-
// txt = str("style = ", style);
176-
// move([50,0,-20]) rot($vpr) color("black")
177-
// text(txt, size=5, halign="center", valign="top");
178-
// }
179-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
180-
// show_triangulation(fn, "flip1", steps=4);
181-
// Example(3D): Triangulating using `style="flip2"`. The opposite pattern from "flip1".
182-
// module show_triangulation(fn, style, steps) {
183-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
184-
// vnf = vnf_vertex_array(pts, style=style);
185-
// grid_vnf = vnf_vertex_array(pts, style="quad");
186-
// color("#ccf") vnf_polyhedron(vnf);
187-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
188-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
189-
// txt = str("style = ", style);
190-
// move([50,0,-20]) rot($vpr) color("black")
191-
// text(txt, size=5, halign="center", valign="top");
192-
// }
193-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
194-
// show_triangulation(fn, "flip2", steps=4);
195-
// Example(3D,Med): Triangulating using `style="quad"`. Lets OpenSCAD do its own internal triangulation. This may error out on older OpenSCAD versions.
196-
// module show_triangulation(fn, style, steps) {
197-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
198-
// vnf = vnf_vertex_array(pts, style=style);
199-
// grid_vnf = vnf_vertex_array(pts, style="quad");
200-
// color("#ccf") vnf_polyhedron(vnf);
201-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
202-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
203-
// txt = str("style = ", style);
204-
// move([50,0,-20]) rot($vpr) color("black")
205-
// text(txt, size=5, halign="center", valign="top");
206-
// }
207-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
208-
// show_triangulation(fn, "quad", steps=4);
209-
// Example(3D): Triangulating using `style="quincunx"`. This artificially adds interpolated points, which may or may not be useful.
210-
// module show_triangulation(fn, style, steps) {
211-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
212-
// vnf = vnf_vertex_array(pts, style=style);
213-
// grid_vnf = vnf_vertex_array(pts, style="quad");
214-
// color("#ccf") vnf_polyhedron(vnf);
215-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
216-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
217-
// txt = str("style = ", style);
218-
// move([50,0,-20]) rot($vpr) color("black")
219-
// text(txt, size=5, halign="center", valign="top");
220-
// }
221-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
222-
// show_triangulation(fn, "quincunx", steps=4);
223-
// Example(3D): Triangulating using `style="convex"`. This is useful for raised hill surfaces.
224-
// module show_triangulation(fn, style, steps) {
225-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
226-
// vnf = vnf_vertex_array(pts, style=style);
227-
// grid_vnf = vnf_vertex_array(pts, style="quad");
228-
// color("#ccf") vnf_polyhedron(vnf);
229-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
230-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
231-
// txt = str("style = ", style);
232-
// move([50,0,-20]) rot($vpr) color("black")
233-
// text(txt, size=5, halign="center", valign="top");
234-
// }
235-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
236-
// show_triangulation(fn, "convex", steps=4);
237-
// Example(3D): Triangulating using `style="concave"`. This is useful for dished surfaces.
238-
// module show_triangulation(fn, style, steps) {
239-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
240-
// vnf = vnf_vertex_array(pts, style=style);
241-
// grid_vnf = vnf_vertex_array(pts, style="quad");
242-
// color("#ccf") vnf_polyhedron(vnf);
243-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
244-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
245-
// txt = str("style = ", style);
246-
// move([50,0,-20]) rot($vpr) color("black")
247-
// text(txt, size=5, halign="center", valign="top");
248-
// }
249-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
250-
// show_triangulation(fn, "concave", steps=4);
251-
// Example(3D): Triangulating using `style="min_edge"`. This triangulates in a way that minimizes face edge lengths.
252-
// module show_triangulation(fn, style, steps) {
253-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
254-
// vnf = vnf_vertex_array(pts, style=style);
255-
// grid_vnf = vnf_vertex_array(pts, style="quad");
256-
// color("#ccf") vnf_polyhedron(vnf);
257-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
258-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
259-
// txt = str("style = ", style);
260-
// move([50,0,-20]) rot($vpr) color("black")
261-
// text(txt, size=5, halign="center", valign="top");
262-
// }
263-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
264-
// show_triangulation(fn, "concave", steps=4);
265-
// Example(3D): Triangulating using `style="min_area"`. This triangulates in a way that minimizes face areas.
266-
// module show_triangulation(fn, style, steps) {
267-
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
268-
// vnf = vnf_vertex_array(pts, style=style);
269-
// grid_vnf = vnf_vertex_array(pts, style="quad");
270-
// color("#ccf") vnf_polyhedron(vnf);
271-
// color("#0dd") vnf_wireframe(vnf, width=0.4);
272-
// color("black") vnf_wireframe(grid_vnf, width=0.5);
273-
// txt = str("style = ", style);
274-
// move([50,0,-20]) rot($vpr) color("black")
275-
// text(txt, size=5, halign="center", valign="top");
276-
// }
277-
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
278-
// show_triangulation(fn, "concave", steps=4);
279139
// Example(3D):
280140
// vnf = vnf_vertex_array(
281141
// points=[
@@ -463,7 +323,146 @@ EMPTY_VNF = [[],[]]; // The standard empty VNF with no vertices or faces.
463323
// for(p=xprofile) translate(p-[0,4,0]) sphere(1.5);
464324
// for(p=yprofile) translate(p-[4,0,0]) sphere(1.5);
465325
// }
466-
326+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="default"`. Triangulates the same direction for every quad.
327+
// module show_triangulation(fn, style, steps) {
328+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
329+
// vnf = vnf_vertex_array(pts, style=style);
330+
// grid_vnf = vnf_vertex_array(pts, style="quad");
331+
// color("#ccf") vnf_polyhedron(vnf);
332+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
333+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
334+
// txt = str("style = ", style);
335+
// move([50,0,-20]) rot($vpr) color("black")
336+
// text(txt, size=5, halign="center", valign="top");
337+
// }
338+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
339+
// show_triangulation(fn, "default", steps=4);
340+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="alt"`. The opposite triangulation from "default".
341+
// module show_triangulation(fn, style, steps) {
342+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
343+
// vnf = vnf_vertex_array(pts, style=style);
344+
// grid_vnf = vnf_vertex_array(pts, style="quad");
345+
// color("#ccf") vnf_polyhedron(vnf);
346+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
347+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
348+
// txt = str("style = ", style);
349+
// move([50,0,-20]) rot($vpr) color("black")
350+
// text(txt, size=5, halign="center", valign="top");
351+
// }
352+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
353+
// show_triangulation(fn, "alt", steps=4);
354+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="flip1"`. Alternates triangulation direction in a grid.
355+
// module show_triangulation(fn, style, steps) {
356+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
357+
// vnf = vnf_vertex_array(pts, style=style);
358+
// grid_vnf = vnf_vertex_array(pts, style="quad");
359+
// color("#ccf") vnf_polyhedron(vnf);
360+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
361+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
362+
// txt = str("style = ", style);
363+
// move([50,0,-20]) rot($vpr) color("black")
364+
// text(txt, size=5, halign="center", valign="top");
365+
// }
366+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
367+
// show_triangulation(fn, "flip1", steps=4);
368+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="flip2"`. The opposite pattern from "flip1".
369+
// module show_triangulation(fn, style, steps) {
370+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
371+
// vnf = vnf_vertex_array(pts, style=style);
372+
// grid_vnf = vnf_vertex_array(pts, style="quad");
373+
// color("#ccf") vnf_polyhedron(vnf);
374+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
375+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
376+
// txt = str("style = ", style);
377+
// move([50,0,-20]) rot($vpr) color("black")
378+
// text(txt, size=5, halign="center", valign="top");
379+
// }
380+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
381+
// show_triangulation(fn, "flip2", steps=4);
382+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="quad"`. Lets OpenSCAD do its own internal triangulation. This may error out on older OpenSCAD versions.
383+
// module show_triangulation(fn, style, steps) {
384+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
385+
// vnf = vnf_vertex_array(pts, style=style);
386+
// grid_vnf = vnf_vertex_array(pts, style="quad");
387+
// color("#ccf") vnf_polyhedron(vnf);
388+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
389+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
390+
// txt = str("style = ", style);
391+
// move([50,0,-20]) rot($vpr) color("black")
392+
// text(txt, size=5, halign="center", valign="top");
393+
// }
394+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
395+
// show_triangulation(fn, "quad", steps=4);
396+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="quincunx"`. This artificially adds interpolated points, which may or may not be useful.
397+
// module show_triangulation(fn, style, steps) {
398+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
399+
// vnf = vnf_vertex_array(pts, style=style);
400+
// grid_vnf = vnf_vertex_array(pts, style="quad");
401+
// color("#ccf") vnf_polyhedron(vnf);
402+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
403+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
404+
// txt = str("style = ", style);
405+
// move([50,0,-20]) rot($vpr) color("black")
406+
// text(txt, size=5, halign="center", valign="top");
407+
// }
408+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
409+
// show_triangulation(fn, "quincunx", steps=4);
410+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="convex"`. This is useful for raised hill surfaces.
411+
// module show_triangulation(fn, style, steps) {
412+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
413+
// vnf = vnf_vertex_array(pts, style=style);
414+
// grid_vnf = vnf_vertex_array(pts, style="quad");
415+
// color("#ccf") vnf_polyhedron(vnf);
416+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
417+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
418+
// txt = str("style = ", style);
419+
// move([50,0,-20]) rot($vpr) color("black")
420+
// text(txt, size=5, halign="center", valign="top");
421+
// }
422+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
423+
// show_triangulation(fn, "convex", steps=4);
424+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="concave"`. This is useful for dished surfaces.
425+
// module show_triangulation(fn, style, steps) {
426+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
427+
// vnf = vnf_vertex_array(pts, style=style);
428+
// grid_vnf = vnf_vertex_array(pts, style="quad");
429+
// color("#ccf") vnf_polyhedron(vnf);
430+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
431+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
432+
// txt = str("style = ", style);
433+
// move([50,0,-20]) rot($vpr) color("black")
434+
// text(txt, size=5, halign="center", valign="top");
435+
// }
436+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
437+
// show_triangulation(fn, "concave", steps=4);
438+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="min_edge"`. This triangulates in a way that minimizes face edge lengths.
439+
// module show_triangulation(fn, style, steps) {
440+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
441+
// vnf = vnf_vertex_array(pts, style=style);
442+
// grid_vnf = vnf_vertex_array(pts, style="quad");
443+
// color("#ccf") vnf_polyhedron(vnf);
444+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
445+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
446+
// txt = str("style = ", style);
447+
// move([50,0,-20]) rot($vpr) color("black")
448+
// text(txt, size=5, halign="center", valign="top");
449+
// }
450+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
451+
// show_triangulation(fn, "concave", steps=4);
452+
// Example(3D,VPT=[50,44,-4.5],VPD=400): Triangulating using `style="min_area"`. This triangulates in a way that minimizes face areas.
453+
// module show_triangulation(fn, style, steps) {
454+
// pts = [for(u=[0:100/steps:100]) [for(v=[0:100/steps:100]) fn(u,v)]];
455+
// vnf = vnf_vertex_array(pts, style=style);
456+
// grid_vnf = vnf_vertex_array(pts, style="quad");
457+
// color("#ccf") vnf_polyhedron(vnf);
458+
// color("#0dd") vnf_wireframe(vnf, width=0.4);
459+
// color("black") vnf_wireframe(grid_vnf, width=0.5);
460+
// txt = str("style = ", style);
461+
// move([50,0,-20]) rot($vpr) color("black")
462+
// text(txt, size=5, halign="center", valign="top");
463+
// }
464+
// fn = function(u,v) [u, v, 16*sin(u*1.8)*-cos(v*1.8)];
465+
// show_triangulation(fn, "concave", steps=4);
467466

468467
module vnf_vertex_array(
469468
points,

0 commit comments

Comments
 (0)