matrixreset rotate

edited June 2017 in DualSPHysics_v4.0
Hi everyone,
I want to draw a box with 10 angle rotation, The position of the box is (22.8 0.72 0.05), the size is (0.15 0.06 0.06). I wrote:

matrixreset/>
rotate x="0" y="0" z="1" angle="-10"/>
drawbox>
boxfill>solid
point x="22.8" y="-3.3" z="0.05"/>
size x="0.15" y="0.06" z="0.06" />
/drawbox>

where y="-3.3" is -(0.72+22.8*tan10). I don't really know the relationship of the initial point and the angle. Sometimes it works sometimes it doesn't work. For example when the angle is 20 the relationship which I thought is wrong, the box is not at the correct position.
So who can help solve this? I really appreciate for it. Thank you very much!

Zijie Li

Comments

  • I concur that the explanation of these features in the XML guides are on the curt side.

    To my understanding, the operations rotate, move, stretch and so forth regard the coordinate systems. The figures in the guide are misleading since the example cube is placed at the origin.

    So you are not moving the individual objects, but the reference system in place at that moment. Then, my interpretation for rotate is that 'x', 'y', 'z' are the coordinates of a vector around which the rotation takes place (only the direction of that vector matters). 'angle' is the amplitude of such rotation. This might be relate somehow to the notion of 'Euler angles, but I am not sure if this too far fetched.

    If you want to draw on object rotated with respect the standard reference axis, you have to bring the reference system onto the object (operation 'move'). Then rotate the axes (operation 'rotate'), draw the object there and, finally, revert to the original reference system with <\matrixreset>. Basically, you are creating a temporary local reference system on which to draw the object.

    Hope this helps anyone interested in this post. Corrections and integrations welcome.
  • If you want to draw a rotated object in the current standard reference axis, you have to bring the reference system temporarily onto the desired location of the object (operation 'move'). Then rotate the axes (operation 'rotate'), draw the object there and, finally, revert to the original reference system with <\matrixreset>. Basically, you are creating a temporary local reference system for drawing the object in the position you like.

    This is one of the paragraphs above rephrased. It seems more precise on second looks. Corrections and integrations welcome always and anyhow.
  • GenCase will create particles in the nodes of a 3-D cubic lattice.
    That 3-D lattice is initially created using pointmin, pointmax and dp.

    Any operation like move or rotate is transforming that 3-D lattice.
    "matrixreset" will allow to recover the initial created 3-D lattice without the previous applied transformations.

    However, in your case it will be easier if you follow the example RotatedBox (https://github.com/DualSPHysics/DualSPHysics/wiki/12.-Testcases#122-extra-examples)

    Regards
  • To link the two terminologies for the benefit of future readers, the standard/original reference system I referred to is then the lattice that Alex referred to. For example:
    
    
       
       
    
    
Sign In or Register to comment.