Conform Script - Point Projection on Surface seems to work strange
Hi Guys, I allready got a great support from the Forum!!! Im working on a Conform Script right know which I plan to use as a modifier. The Problem at the moment ist that the Plane Projection creates strange placing of my vertices. Basicly I search for the three enarest Vertices fro every vertice in my Object. Then I make a Point Projection on theSurface.
fn checkNearestEdge SelectedVerticeID =
(
oV = SelectedVerticeID.pos
pairs = for o in refObj.selectedVerts collect #(length(o.pos-oV), o.index ) --pairs distance and vertexpos
qsort pairs sortByDist --indexes and sorts
x0 = polyop.getVert refObj pairs[1][2]
x1 = polyop.getVert refObj pairs[2][2]
x2 = polyop.getVert refObj pairs[3][2]
offset = 0.01
x0 = x0 + [0,0,offset]
x1 = x1 + [0,0,offset]
x2 = x2 + [0,0,offset]
print "go"
print SelectedVerticeID.pos
print x0
print x1
print x2
newVert = pointPlaneProj x2 x1 x0 SelectedVerticeID.pos
moveVertices SelectedVerticeID.index newVert
)
-------------------------
fn pointPlaneProj pA pB pC pD = (
local nABC=normalize (cross (pB-pA) (pC-pA))
newPoint = pD+((dot (pA-pD) nABC)*nABC)
return newPoint
)
Comments
Okay wow tested it and no
Okay wow tested it and no matter if my works its so much slower.... thanks a lot
.
I guess you can use MeshProjIntersect for that purpose
Thanks you very much. But i
Thanks you very much. But i was trying to do it with the manuel Projection do u have any idears to that? Greetings
.
I don't quite understand what end result you're trying to achieve, sorry.
No Problem :D is my fault. Im
No Problem :D is my fault. Im making a Point on Surface projection with every Vertice to the three nearest Vertices of an Reference Mesh. So In theory if u have the Three Vertices u can create a Face and Project the Vertice on the shortest path onto this Face. So every Vertice should snap to the nearest point of a reference Mesh.
Greeting Eli
.
So isn't my example above (using MPI) doing exactly what you need? It creates red point helpers at the closest point on mesh.
Or maybe you need to place projected verts onto closest vert (not point on face)?
Hi jahman thanks for your
Hi jahman thanks for your help till know. Maybe you hava an IDear hwo I could Confm my Mesh without converting it to editable_poly? I would like to build a script which conforms Vertices created thorugh a subdivison Modifer (Withouth collapsing it). Greetings EliderDeli
.
I guess simpleMod is your only option.
Google "simpleMod saddle" example
Thank you very much ,again
Thank you very much ,again :). I will have a look at it
No it does exactly what I
No it does exactly what I need (Thanks a lot for that). Im only unsure why my code doesnt work and would be realyy interested where i made a mistake (it works but not for all vertices but iterate through all and checked at multiple parts in the script if the values are right).
fn checkNearestEdge SelectedVerticeID =
(
oV = SelectedVerticeID.pos
pairs = for o in refObj.selectedVerts collect #(length(o.pos-oV), o.index ) --pairs distance and vertexpos
qsort pairs sortByDist --indexes and sorts
x0 = polyop.getVert refObj pairs[1][2]
x1 = polyop.getVert refObj pairs[2][2]
x2 = polyop.getVert refObj pairs[3][2]
xoffset = 0.00
yoffset = 0.00
zoffset = 0.00
x0 = x0 + [xoffset,yoffset ,zoffset]
x1 = x1 + [xoffset,yoffset ,zoffset]
x2 = x2 + [xoffset,yoffset ,zoffset]
moveVertices SelectedVerticeID.index (pointPlaneProj x2 x1 x0 SelectedVerticeID.pos)
)
fn pointPlaneProj pA pB pC pD =
(
local nABC=normalize (cross (pB-pA) (pC-pA))
newPoint = pD+((dot (pA-pD) nABC)*nABC)
return newPoint
)
move just moves and works