sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    ? on transformation

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 223 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      Where find is a entity, can someown tell me what the difference is between:
      model_transformation=Geom::Transformation.new([0,0,0,point_vector)
      find.transformation = model_transformation]
      and:
      find.transform! Geom::Transformation.new([0,0,0,point_vector)]
      The different codes result in moving the entity "find" to different locations in the model.

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        .transformation = and .transform! are different things. Transsform! will add one transformation onto another one. Lets say you have a component that sits at 10,10,10, and is already scaled to be 5 times its normal size. Then run this on it

        t = Geom::Transformation.scaling 2.0 my_comp.transform! t

        That will take the existing transformation (of 10,10,10 location and 5x larger) and add the new transformation to it. We scale up by 2x. So after the transformation, the comp will 10x as big as the definition, and its location will move 2x away from the origin also. So if it was at 10,10,10 - it will move to 20,20,20 (I guess, I don't know my trig!).

        Now if we run

        t = Geom::Transformation.scaling 2.0 my_comp.transformation = t

        This will reset the transformation that had been on the component (of 10,10,10 and 5x its original size), and make its transformation equal to the supplied one. So it will reset its location to 0,0,0 (because our transformation did not include a location to move to) and it will set its overall scale to just 2x larger. So in the end you get a component whose transformation equals the one supplied of location 0,0,0 and scale of 2x larger than the definition.

        So the .transform! is like a compound transformation, or adding a transformation onto the existing one. .transfomation = is like setting the transformation equal to the supplied transformation, restting any transformation that might have previously been in place.

        Hope that makes sense.....hope that was what you were asking about!

        Chris

        EDIT: I changed a detail in the first example about the location, what I had written at first was incorrect.

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

          Chris, thanks, yes that helps me to understand.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            .transform! uses the Group's or Instance's current Transformation and applies the new one (change by a Transformation)

            .transformation= simply replaces the Group's or Instance's Transformation with the new one (change to a Transformation.)

            For example, if you use the IDENTITY matrix:

            entity.transform!(IDENTITY) - no change.

            entity.transformation= IDENTITY - position, rotation and scaling are all reset.

            Hi

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement