Edited by e-tyrell80, 20 June 2013 - 05:51 AM.
Scale up an object on a plane
Members - Reputation: 103
Posted 20 June 2013 - 05:49 AM
Members - Reputation: 1148
Posted 20 June 2013 - 08:07 AM
You'll have to scale it and then translate (move) it in the direction of the plane's normal by some amount.
//You must know the distance (for each axis) from the center point of your object (it's origin) and the point that touches the plane //I'll call this distance, and put some random value vec3 distance = (0.0f, 3.0f, 0.0f); //In this example the object is at the center of the world, but move up in the Y axis by 3.0. //Now do the scaling (remember scaling by 1.0 means staying the same) //We're just scaling in the Y axis glScalef(1.0f, 2.0f, 1.0f); //Calculate the amount to translate the object vec3 move; //The <scale.X>, etc are the values passed to glScalef() //We subtract 1.0f from the scale value, again because 1.0f is the starting value (identity). move.x = distance.x * (<scale.x> - 1.0f); move.y = distance.y * (<scale.y> - 1.0f); move.z = distance.z * (<scale.z> - 1.0f); //Translate the object glTranslatef(move.x, move.y, move.z);
Hope you understand (and that it is correct... i think so),