sketchucation logo sketchucation
    • Login
    1. Home
    2. markozeta
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 53
    • Groups 1

    markozeta

    @markozeta

    10
    Reputation
    1
    Profile views
    53
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    markozeta Unfollow Follow
    registered-users

    Latest posts made by markozeta

    • RE: Get the global rotation of a DC

      Alright, did the matrix math for ya. Ready?

      Your complete rotation matrix for your system is:

      (C_C)(C_B)+(S_A)(S_C)(S_B); (S_A)(S_C)(C_B)-(S_B)(C_C); (C_A)(S_C);;
      (C_A)(S_B); (C_A)(C_B); -(S_A);;
      (S_A)(S_B)(C_C)-(C_B)(S_C); (S_A)(C_B)(C_C)+(S_B)(S_C); (C_A)(C_C);;;

      WHERE:

      S_ represents sine, C_ represents cosine
      A is first angle (rotation about global/local X) - doesn't matter which since global is local for first rotation.
      B is second angle (rotation about global Z)
      C is final angle (rotation about local Y)

      So, you need to make the .to_a matrix of your rotation be equal to this matrix (after normalizing the axis vectors), then solve for A, B, and C. This matrix is very similar to rotation of Z, then X, then Y, but still different.

      posted in Dynamic Components
      M
      markozeta
    • RE: [Work-in-Progress] DC "Animate" record macro

      @thomthom said:

      What are the problems you're having with the attributes? Example?

      Well, I opened up the Sketchup Attribute Manager. http://code.google.com/p/sketchupattributemanager/wiki/Welcome. Using this, I made a simple dynamic component. When I loaded the attributes X, Y, Z onto the component, they showed up on the attribute manager. Then when I moved the block, reloaded the attribute manager, the new coordinates were not updated. This same issue happened when I scales and rotated the component, compelling me to believe the problem was most likely with the attribute manager not reading the dc (even after I hit redraw). I don't know of something similar to the attribute manager that will work with DC's, and that' my real difficulty. Without it, debugging this idea will be difficult without knowing exactly the formatting of the current functions.

      posted in Dynamic Components
      M
      markozeta
    • RE: Get the global rotation of a DC

      Ahh, I see.

      The rotation matrix of a rotation about global x is [[1, 0, 0][0, c, -s][0, s, c]]; rotation about global z is [[c, -s, 0][s, c, 0][0, 0, 1]].

      Rotation about LOCAL y is a bit harder - are you sure this is not global? For this, we use http://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula.

      ` V(rot) = V*c + (Z x V)s + (ZV)Z(1-c), where:

      Lower case are scalars
      Upper case are Vectors
      V(rot) is the new vector
      V is the old vector
      Z is the global rotation vector
      c is cosine
      s is sine

      • indicates dot multiplication
        x indicates cross multiplication`

      Combined, this can get you where you need to go - sorta. Lemme know if you need help on the matrix multiplication.

      posted in Dynamic Components
      M
      markozeta
    • [Work-in-Progress] DC "Animate" record macro

      This was actually my suggestion to all for the google product page information. Then I realized that it should be possible to program myself. At least I think so.

      I know how to do the math, but can't for the life of me figure out how to read attribute dictionaries. I read up on chris fullmer's tutorials on these things, and when I used webconsole with the attribute dictionaries, it didn't help.

      So, bear with me while I work on this idea, but I think I can make it happen. This will be my first script that I'll do.

      posted in Dynamic Components sketchup
      M
      markozeta
    • RE: Get the global rotation of a DC

      @lachlan said:

      Is there some mathematical way to do it? Or even better, an inbuilt ruby command?

      Well, yes and no.

      Take components transformation matrix. Do a transformation.to_a.

      Matrix is 4x4. I'll work with the top row for this example, the other rows are similar.

      1, 2, 3, 0 for top row. Then this is a stretched x-axis, so you must normalize the axis. To do this, divide it by it's magnitude (in this case, it's 1^2+2^2+3^2, or 14. 1/14 = .072, 2/14 = .143, 3/14 = .214) This is the unscaled x-axis (since the transformation matrix is multiplied by the scale factor). Repeat for rows 2 and 3. Four relates to positioning.

      Multiply these 3x3 matrices by itself for nested components. This will get you the global transformation (at least for rotations). Note that you can just normalize the axis at the end of transformation as well - this will allow you to recover the global scale as well. Then use the euler angle formulas to find out the angles (http://en.wikipedia.org/wiki/Euler_angles#Derivation_of_the_Euler_angles_of_a_given_frame)

      posted in Dynamic Components
      M
      markozeta
    • RE: Get the global rotation of a DC

      Rotations are not linear.

      Take a cube, with all 3 lengths different. Copy it. Rotate it 90 degrees on the X, then 90 degrees on the new Y. Take the same cube, rotate it 90 degrees on Y, then 90 degrees on the new X. It's different. This is because rotations are not linear - a + b != b + a.

      Sooo, what to do is realize how sketchup works. Sketchup rotates first on X, then on Y, then on Z. Thus, by rotating along X by 35, then on the new Y by -30, then finally by -36. This creates the same as 45 on Z, then 45 on new X.

      The two are equivalent. http://en.wikipedia.org/wiki/Euler_angles#Table_of_matrices will demonstrate. Sketchup system has a basic rotation matrix using the xyz. This is EQUIVALENT to your system (using ZXY, for example, with a rotation about Y of 0). Do the math yourself, you'll see that you wind up with the same matrix or you'll wind up with a transposed matrix, or to say the least a rearranged matrix. (i.e. what was in row 1 is now in row 2, and what was in column 1 is now in column 2, etc)

      Back to your original question though - those are the global X,Y,Z rotations, assuming that the rotations you are reading are not nested inside of another component- but they are in rotate X, then Y, then Z notation.

      Side note - if you do have a nested dynamic component, and need to get the global rotations of a nested dc, you need to take the rotations of the parent, assemble the rotation matrix as explained in the wikipedia article. Then construct the nested component's rotation matrix. Finally multiply the two matrices together. Once you've done that, deconstruct the product (beware of gimbal lock when you deconstruct the matrix; this occurs if the middle rotation is 0 degrees - however as long as you can deal with a rotation of 2 degrees in the X and 3 degrees in the Z being the equivalent to 3 degrees in the X and then 2 degrees in the Z, you'll be ok).

      posted in Dynamic Components
      M
      markozeta
    • RE: Dynamic Component Copies and Transformation

      Jon,

      I don't know much about Ruby, or components.

      I do know that the "generate report" function of pro version is a ruby script by google, and that it (for the most part) can read this problem. That being said, since this is the weekend and I only have my free version here, take my dynamic flange model (posted in the dynamic components section of these forums), which has multiple, multiple embeded copies as a test model. Run the "generate report" function on that model - I believe it will tell you what the X,Y,Z of each component is - and it will give you the same information as you've been getting. Not much help.

      So, that's what the attribute dictionary is getting. By searching, however, you can pull out information about the copies function (i.e. copy number). You can also find the formula for X,Y,Z by finding _X_Position_Formula (or something similar). Using the direct formula, you could in theory look for the word "copy" in the Position formula, and find out what X SHOULD BE by doing the math yourself.

      Not pretty, but that's the only thing I can think of until I play around with my pro version at work.

      posted in Developers' Forum
      M
      markozeta
    • RE: [Plugin] Proper Animation V1.08 Beta(Updated 14/11/10)

      @dave r said:

      I saw a post in the SketchUp forum about making a paper airplane animation. I was curious and thought I'd play with it. In the attached model, I've got two components. The triangular one is supposed to fold up. As it does, though, it moves away from the other component. When I rotated it, I rotated along the edge common to both. Is there a way to make the component "hinge" on the edge?
      [attachment=1:wt057bzy]<!-- ia1 -->Folding Paper.skp<!-- ia1 -->[/attachment:wt057bzy]

      This seems to be an issue with the transformation.interpolate - interpolate only works by interpolating the movements, but rotations of multiple axis are not linear functions - and therefore cannot be interpolated.

      Instead, to obtain the full information about the object, information about a second point must be known.

      Imagine rotating a ball counterclockwise 90 degrees about the x axis and then 90 degrees CCW about the y axis, v. rotating a ball 90 degrees CCW about the y axis and then 90 degrees CCW about the x axis. It's not the same! The point (0,1,0) would be moved to (1,0,0) in the first instance, and it would be at (0,0,1) in the second instance!

      With a little bit of effort, I think I can fix this (yay for paying attention in my dynamics course!) assuming the author does not mind? It would just take a bit of direct manipulation on the transformation matrix. (and a better understanding from myself of Ruby, it seems I can read ruby but can never write it).

      posted in Plugins
      M
      markozeta
    • RE: Sketchup 7.1 bugs

      I can't select a section plane once I put it in my model!

      Help!

      posted in SketchUp Bug Reporting
      M
      markozeta
    • French, German, Italian, Spanish OH MY!

      http://sketchupdate.blogspot.com/2009/09/google-sketchup-7-is-now-available-in.html

      Seems like they were working on this all along. Even yesterday I saw that french was 6, now it's 7 for all.

      posted in SketchUp Discussions sketchup
      M
      markozeta