#### Archived

This topic is now archived and is closed to further replies.

# How I calculate teh s/t coords after I split a polygon?

This topic is 5174 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello!! i push a list of polygons(triangles or quads) in the bsp with the U and V (or s and t) be known. while building the bsp some polygons are splitting. how i can calculate the new U/V(or s/t) Cordinates of the new polygons?

##### Share on other sites
would this work:

assume the edge (ab) of your face is split at vertex c:
a--------------b becomes: a-------c------b

get the length of the edge you just split (ab)
get the length of the new vertex to a (ac)
get ratio (ac) over (ab)
get length of (a.uv) to (b.uv)
2dLen = mult this length by ratio
get normalized vector from (a.uv) to (b.uv)
mult 2dLen by normalized vector from (a.uv) to (b.uv)
add this vector to a.uv

I think this should work, i''ve never tried it but it seems simple enough.

##### Share on other sites
You should be able to just linearly interpolate the texture coordinates. If I''m not mistaken, if you have a Vector2 class with all the standard operators, you should be able to do the same math with the texture coordinates that you did with your regular vertices, and get the right results.

1. 1
Rutin
26
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002135
×