Skip to main content
GameDev.net gamedev.net
🔒 Locked

Resizing shapes

Started by garusher Feb 25, 2009 at 7:24 AM 3 replies 600+ views
Original Post
garusher
garusher
Hi, Well i've had a brain wave. couldn't i do the following the increase height of a shape. 1) find the lowest [base] horizontal plane 2) change the vertices for everything thats above the horizontal plane Thanks Gary Rusher
garusher
garusher
Hi,

Does anyone have any Direct3d math to achieve this?

Thanks
Gary Rusher
Winegums
Winegums
Nothing direct-3d specific, but I think the following would generally work.

//Create a D3DVECTOR3 equal to element 0 of the vertex buffer.//For each vertex that comprises the shape    //If it's y-position is lower than the lowest value we've currently got    //store the value of that element//For each vertex that comprises the shape     //If the points y-value is NOT the same as the stored vector3              //Increase height
Nyarlath
Nyarlath
Quote:
Original post by Winegums
              //Increase height


For a linear stretch:

new_height = (old_height - min_height) * factor + min_height


If "factor" is greater than one the height of the shape will be increased.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.