Notifications
Clear all
[Closed] Is there a way to calulate the cut line?
Jul 28, 2011 3:22 pm
These lines just next to the texture’s edge
sorry, I cannot upload a picture…
think about there is a triangle, a cricle-shape texture take an Alpha channel on it; Now,how to cut line just next to the cirle edge?
1 Reply
Jul 28, 2011 3:22 pm
also I have a piece of code, in some cases it works good, in others it is wrong!
because some polys have same UV to seem, in fact it’s not! It’s upsidedown, or turned around…
that’s why it cann’t work good,but these Poly-objects are same.
so any suggests to me are appreciate.
fn getVIndex obj theFace =
(
--must be Mesh:
if classof obj != editable_mesh then convertToMesh obj
tv1 = getTVert obj (getTVFace obj theFace).x
tv2 = getTVert obj (getTVFace obj theFace).y
tv3 = getTVert obj (getTVFace obj theFace).z
tvs = #(tv1,tv2,tv3)
index = #()
for i in 1 to tvs.count do
(
if tvs[i].y > 0.9 then index[1] = i
if tvs[i].x < 0.1 then index[2] = i
if tvs[i].y < 0 then index[3] = i
)
index
)
obj = $
index = getVIndex obj 1
vertA = getVert obj index[findItem index 1]
vertB = getVert obj index[findItem index 2]
vertC = getVert obj index[findItem index 3]
vAB = normalize (vertB - vertA)
vBC = normalize (vertC - vertB)
vCA = normalize (vertA - vertC)
--cut point:
a = vertA + (75.6 * vAB) --A towards B
b = vertA + (52.5 * (-vCA)) --A towards C
c = vertC + (64 * vCA) --C towards A
d = vertC + (81.3 * (-vBC)) --C towards B
f = vertB + (93.6 * vBC) -- B towards C
g = vertB + (33.5 * (-vAB)) --B towards A
--start Cut:
convertTo obj editable_poly
subObjectLevel = 0
theNormal = polyop.getFaceNormal obj 1
obj.cutFaces 1 a b theNormal
obj.cutFaces 2 c d theNormal
obj.cutFaces 3 f g theNormal
subObjectLevel = 2
polyOp.splitEdges obj (polyOp.getEdgeSelection obj)
polyOp.deleteFaces obj (polyOp.getFacesUsingVert obj #{1,2,3}) delISOVerts:true
subObjectLevel = 0