Hi. Does anyone know how to do it?
Lets say I have a flat concave/convex polygon with N vertexes and I would like to project it on the surface of a mesh along some direction vector. Basically like a decal or imprint in pro-boolean. The result mesh should have the topology of the mesh on which proijection was done.
Example (was done using pro-boolean):
Any clues? Known methods? Or existing functions that I can dig in?
Thanks.
Replies
- -- creates a ray point along the edge
-
- fn getEdgeRay msh edg =
- (
- ze = edg - 1;
- a = (mod ze 3) + 1;
- b = mod a 3;
- fverts = getface msh (ze/3 + 1);
-
- v0 = getvert msh fverts[a];
- v1 = getvert msh fverts[b + 1];
-
- ray v0 (normalize (v1 - v0));
- )
-
- -- create tranform matrix from the edge dir and the face normal
-
- fn get_edge_planes mobj =
- (
- edges = meshop.getOpenEdges mobj;
- y = getFaceNormal mobj 1;
-
- for edg in edges collect
- (
- eray = getEdgeRay mobj edg;
- x = eray.dir;
- z = normalize (cross x y);
- matrix3 x y z eray.pos;
- )
- )
-
- fn wrap_planar_poly_to targ srce =
- (
- setCommandPanelTaskMode #create; -- being in modify is slow
-
- wrapped = snapshot targ; -- duplicate the target
-
- iotm = inverse wrapped.objecttransform;
- xforms = get_edge_planes srce;
- for tm in xforms do
- (
- m = sliceModifier();
- m.Slice_Type = 2;
- m.slice_plane.transform = tm * iotm;
- addModifier wrapped m;
- )
-
- convertToMesh wrapped; -- collapse to mesh
-
- srce_normal = getFaceNormal srce 1;
-
- backfacing = for f = 1 to wrapped.numfaces collect
- (
- normal = getFaceNormal wrapped f;
- if dot normal srce_normal < 0 then f else dontcollect;
- )
- meshop.deleteFaces wrapped backfacing;
- setCommandPanelTaskMode #modify;
-
- wrapped;
- )
-
- wrap_planar_poly_to $GeoSphere01 $NGon01
this was the test set upSo from what I see you just slicing the copy of the mesh along its eges in the direction of polygon normal?
I mean. I could just do the same as you did but for every single triangle and then combine and weld it back. But something tells me there's a better way to do it.
Yo! This seems exactly what I was looking for thanks.