bugpyFormex - Bugs: bug #40735, extension of Coords.rotate to do...


bug #40735: extension of Coords.rotate to do multiple rotation at once

Submitted by:  francesco <francio>
Submitted on:  Thu 28 Nov 2013 02:08:45 PM UTC  
Category:  Core Severity:  3 - Normal
Item Group:  Feature request Status:  Need Info
Privacy:  Public Assigned to:  Benedict Verhegghe <bverheg>
Open/Closed:  Open

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 29 Nov 2013 01:04:12 PM UTC, comment #3:

I fail to see the application for that: in most cases you will end up with impossible geometry and create nothing but chaos.

But if you have an application, I have nothing against implementing it, if it does not affect the current methods too much.

I think it can be done within the current logic:

- Coords.affine would not have to change
- Coords.rotate: this might be a bit of a problem, needing a lot of dimension checking: one angle, one axis, one around; multiple angles, multiple axes and multiple arounds; and all possible combinations; and then still allowing a direct rotation matrix.
This will probably too much overhead for an everyday operation.
-arraytools.rotationMatrix: can probably easily be changed to compute many rotation matrices at once.

So the problem will be the Coords.rotate: it might be better to no change it, but add a rotateMat(mat,around) that just does:

if around is None:
    out = self
    out = self.translate(-asarray(around))
return out.affine(mat,around)

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Fri 29 Nov 2013 12:27:53 PM UTC, comment #2:

it gives all the points of a Coords a different rotation.
per every point , you can specifify a differnt rotation axis, a differnt angle and initial point around which to rotate.

I put the rotation matrix inside the function and did all what the normal rotate was doing by calling different methods because

arraytools.rotationMatrix cretae only a 3x3 matrix (now is 3x3x ncoords)
Coords.rotate make a check if rotationMatrix is 3x3 , error otherwise
affine uses the dot product which does not allow to perform multiple rotation I want (every rotmatrix slice X evry coord)

I think by modyfieng the mentioned funtions we can just extend rotate to perform multiple rotations

francesco <francio>
Project Member
Fri 29 Nov 2013 06:37:32 AM UTC, comment #1:

It is not clear to me what is meant here with multiple rotation:

- give all the points of a Coords a different rotation?

- or perform multiple subsequent rotations? If so, are subsequent rotations defined in the original (global) axes, or in the axes resulting from the previous transforms?

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Thu 28 Nov 2013 02:08:45 PM UTC, original submission:

I created this function where
can have values of the coords array. I think rotate affine and other funtions in coords can be all modified to be extended to this approach so that the function can use already existing rotation fuunctions. I am afraid to modify the core so i post the code to get suggestions abbout how it can be embedded in coords.

def rotmany(coords,angle,axis,around=None):
    if around is not None:
        around = asarray(around)
        out = out.translate(-around)

    a = angle # in degree
    c = cosd(a)
    s = sind(a)
    t = 1.-c

    X,Y,Z = axis.T
    rot = [ [ t*X*X + c  , t*X*Y + s*Z, t*X*Z - s*Y ],
              [ t*Y*X - s*Z, t*Y*Y + c  , t*Y*Z + s*X ],
              [ t*Z*X + s*Y, t*Z*Y - s*X, t*Z*Z + c   ] ]


    return Coords(out)

francesco <francio>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by francio (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-29 bverheg StatusNone => Need Info

    Back to the top

    Powered by Savane 3.4