Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Scaling along a vector

  1. #1
    Intern Contributor
    Join Date
    Feb 2002
    Location
    Wiesbaden, Germany
    Posts
    95

    Scaling along a vector

    glHi,

    okay, everything else is solved . Now I'm facing the next problem which is scaling an object along a given vector . What I need is the mathematics behind it not the glFuncs.

    Thanks,

    Martin

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    125

    Re: Scaling along a vector

    Scaling along a vector doesn't really make any sense. It seems like what you mean is scaling along a local coordinate system (which doesn't necessarily have to be the local coordinate system of the object, if there even is one).

    Or are you trying to achieve an effect closer to something like Soft Selection+Translation which is common in Modeling Programs like 3d Studio Max or Maya.

    ?

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,407

    Re: Scaling along a vector

    is this what u want>
    vector*scaling factor

    eg
    vertex.x = vertex.x + vector.x * scaling_factor
    vertex.y = vertex.y + vector.y * scaling_factor
    vertex.z = vertex.z + vector.z * scaling_factor

  4. #4
    Intern Contributor
    Join Date
    Mar 2002
    Posts
    65

    Re: Scaling along a vector

    I think mphanke is asking how to stretch an object in a given direction.

    One method to do that would be to transform(rotate) your objects (using your code not gl's) such that one of the axes aligns with the direction in which the object has to be stretched.Then scale the objects along the axis with the scale factor and lastly do the inverse transformation to return to your original coordinate system.

    Another method would be. . .(I havent checked this out yet, but seems to be right)

    if V (vector)is your vertex,S (scalar) the scaling factor,D (unit vector) the direction in which scaling is to be done, then
    V' = V + (S-1)*(Vp)

    where Vp is the vector obtained by projecting V onto D.


    hope this helps.


    [This message has been edited by tarantula (edited 03-26-2002).]

  5. #5
    Intern Contributor
    Join Date
    Feb 2002
    Location
    Wiesbaden, Germany
    Posts
    95

    Re: Scaling along a vector

    Hi,

    thanks very much to all of you! Tarantula got me right that was exactly what I was looking for. As a short explanation, what I'm doing is fitting 4 point clouds together to recreate a physical object.
    If someone is intrested mail me I have some funcs done (things like rotating around a given vector, a point in space and a vector, all rotations and all transformations , all physical vertex transforms!)
    That would then be my way to say thanks to all of you!

    Again thanks very much,

    Martin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •