Python / c# problem rotation transform

I am doing something wrong, the points became mirrored while they actually would be rotated 180 degrees along the ZAxis.

What am I doing wrong?
Thank you for your response :slight_smile:

problem rotation 01.gh (10.4 KB)

Hi @ForestOwl,

Your points are mirrored because your 180 degree rotation is out of the plane, not around in it.

You can achieve the combined rotation and translation in one using the Transform.PlaneToPlane() method.

You can change your code like this:

import rhinoscriptsyntax as rs
import Rhino as rc

def move_pnts(pnts,basepl,pl):
#    turntr=rc.Geometry.Transform.Rotation(basepl.XAxis,pl.XAxis,basepl.Origin)
#    movetr=rc.Geometry.Transform.Translation(rc.Geometry.Vector3d(pl.Origin-basepl.Origin))
    turnpl=rc.Geometry.Transform.PlaneToPlane(basepl, pl)
    
    movedpnts=[]
    for p in pnts:
        copypn=rc.Geometry.Point3d(p)
#        copypn.Transform(turntr)
#        copypn.Transform(movetr)
        copypn.Transform(turnpl)
        movedpnts.append(copypn)
    #movedguds=rs.RotateObjects(movedpnts,pl.Origin,rs.VectorAngle(basepl.XAxis,pl.XAxis))
    #movedpnts=[rs.coerce3dpoint(g) for g in movedguds]
    
    return movedpnts


newpnts=move_pnts(pnts,basepl,pl) 

Regards
Jeremy

2 Likes