Geom::Transformation.new(pt, xaxis, yaxis)
-
It makes a new transformation, within its origin at pt and new x and y axis vectors.
When it is applied to an entity it should change the entity's origin and x & y axes ? -
I tried by creating a transformation using that method - and then use that transformation object as such
instance.transform!( t )
Is it not suppose to be used like that? I thought it's do a move and rotate operation - offset from the current transformation. But I'm not getting a predictable result... -
it mgiht need to be
.transformation = t
. try that and I wonder if it will get more predictable results. Perhaps not the right ones, but maybe more predictable. -
yes - I tried that - but it isn't what I want though. as I want to modify the existing position, rotation and scaling - offsetting the position and rotation.
So maybe I'm using the wrong method, but then I'd still like to understand what this one does and what it is intended for.
-
I'm pretty sure it is the same as .axes, but it crosses the Z axis automatically.
Can you tell us what you are trying to do in particular, or are you just curious?
-
I have a specific case - and I'm curious. I'll upload a case sample.
-
Try Chapter 16. There is almost never a reason to use a Transformation directly. Just move, rotate and scale as you wish.
-
Here is what I tried: use this transformation type to place the car on the face under it.
The data I have:-
instance origin
-
instance x and y vector
-
new origin
-
new x and y vector
Could this transformation be used for this?
-
-
If you don't care about scale, this should work fine, although it may flip the car upside down if the expected z axis does not correspond with the input axes:
instance.transformation = Geom::Transformation.new(newOrigin,newXAxis,newYaxis)
I would suggest using something like this (untested):
trans = instance.transformation scales = [trans.xaxis.length,trans.yaxis.length,trans.zaxis.length] inputX.normalize! inputY.normalize! inputX = inputX * scales[0] inputY = inputY * scales[1] newTrans = Geom;;Transformation.axes(newOrigin,inputX,inputY,face.normal * scales[2]) instance.transformation = newTrans
-
@cjthompson said:
If you don't care about scale
I do.
@cjthompson said:
although it may flip the car upside down if the expected z axis does not correspond with the input axes:
Yup - noticed this to.
@cjthompson said:
I would suggest using something like this (untested):
> trans = instance.transformation > scales = [trans.xaxis.length,trans.yaxis.length,trans.zaxis.length] > inputX.normalize! > inputY.normalize! > inputX = inputX * scales[0] > inputY = inputY * scales[1] > newTrans = Geom;;Transformation.axes(newOrigin,inputX,inputY,face.normal * scales[2]) > instance.transformation = newTrans
Interesting. I was looking as the axes
method
, but I kept having problems with maintaining scaling.Another thing: what if the component is skewed?
-
Do you want the transformation to have the same properties as the original(skew, scale, etc.) in the final result, or are you asking how to prevent skewing?
-
No - I wondered if it preserved it.
I wanted to only move and rotate the object to a new plane. I wondered if this method would be an option as oppose to combining a translation and two rotation transformations. -
@thomthom said:
No - I wondered if it preserved it.
I wanted to only move and rotate the object to a new plane. I wondered if this method would be an option as oppose to combining a translation and two rotation transformations.Well, first you have to determine which axis gets priority (because the angles between the axes in the original transformation may not be the same as the angles between the axes the user picked) then measure the angles between the prioritized axis and the other two, and apply the angles to the user axes (including face normal).
I'm pretty sure that doesn't make sense but I can't think of how else to describe it.
If you have any specific questions, I might be able to help a bit more.
Advertisement