 # Relative plane, when two planes are known

I would like to ask if it is possible to get transformation matrix to transform Target plane when only two planes are given Known Target Plane and Known Relative Plane.

The current logic I have to get a new relative plane is this :

1. Transform Known Relative Plane from Known Target Plane to XY Plane
2. Transform the Known Relative Plane from XY to Target Plane.

The PlanePlane transformation dont work, I tried.

Is it possible to do the same but somehow calculating transformation matrix in order to multiple Target Plane by Transform.

Question.gh (19.2 KB)

``````   private void RunScript(Plane G, Plane A, Plane B, ref object R)      {

this.Component.Message = "Transform B Plane by G and A";
//First Transformation
Transform toWorldXY = Transform.PlaneToPlane(A, Plane.WorldXY);
Plane B_ = new Plane(B);
B_.Transform(toWorldXY);

//Second Transformation
Transform fromWorldXYToP0 = Transform.PlaneToPlane(Plane.WorldXY, G);
B_.Transform(fromWorldXYToP0);

R = B_;

}``````

Well … I don’t get the gist of the whole thing: A pTop Transform requires a From and a To Plane. What is the role of the relative plane?

Anyway, given the opportunity, see this:

Transform_PtoP_Matrices.gh (8.8 KB)

Hey Petras,

If I understand correctly, this is similar to solving for the wrist position of a robot given a tool offset? I.e - you need to find the transformation from target A to target B, given the flange position G to find the new flange position G_, but you are having an issue with the RC P2P method directly, whereby the matrix is showing some mirroring or weird rotations?

Unfortunately codewise I would have approached it identically to you, ensuring that I make a new instance of the flange plane G. Simplified:

``````Transform xForm = Transform.PlaneToPlane(wobj.CSPlane, Plane.WorldXY);
Plane trg = new Plane(target);
trg.Transform(xForm);
``````

Where wobj.CSPlane is your intermediate plane.

As for whether you can do this on the matrices directly for multiple targets / links, then yes - I just don’t have it on hand - I can look for it in the morning. 1 Like