PLtransR

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Spatial Relations
Introduced first in SolidGeometry 1.6, Creation date: 2014-11-21, Last change: 2025-09-14

rotates all point of a point list

Description

Simply calculates PL=(R*PL')';

See Also: PLtransP , PLtrans , PLtrans0 , PLtrans1 , PLtransT , PLtransC

Example Illustration

 missing image of PLtransR(PL,R)

Syntax

PL=PLtransR(PL,R)

Input Parameter

PL: Point List (nx2)
R: Rotation matrix 2x2

Output Parameter

PL: Transformed Point list

Examples

Rotate a square
PL=PLcircle(10,4);
CPLplot([PL;NaN NaN;PLtransR(PL,rot(pi/6))]);




Copyright 2014-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, PLtransR, is designed to rotate a list of 2D points using a given rotation matrix. Below is a detailed explanation of the algorithm and its parameters.

Input Parameters

Output

Algorithm Steps

  1. Check if R is a scalar. If true, convert it to a rotation matrix using the rot function.
  2. Apply the rotation to the point list PL by multiplying the rotation matrix R with the transpose of PL, and then transpose the result back.
  3. If no output is requested (i.e., nargout == 0), plot the transformed points using SGfigure and PLplot.

Example Usage

To rotate a square, you can use the following example:

PL = PLcircle(10, 4); 
CPLplot([PL; NaN NaN; PLtransR(PL, rot(pi/6))]);

This example creates a circle of points and then rotates it by pi/6 radians.

Algorithm explaination created using ChatGPT on 2025-08-18 23:33. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21