rototranslation.py
Go to the documentation of this file.
1 import math
2 
3 
4 def rototranslate(x0, y0, angle):
5  alpha = float(angle)*math.pi/180.0
6  cos = math.cos
7  sin = math.sin
8 
9  def RT(x, y):
10  return x0+x*cos(alpha)-y*sin(alpha),y0+x*sin(alpha)+y*cos(alpha)
11  return RT
12 
13 
14 def inverseRT(x0, y0, angle):
15  alpha = float(angle)*math.pi/180.0
16  cos = math.cos
17  sin = math.sin
18 
19  def iRT(x, y):
20  return -x0*cos(alpha)-y0*sin(alpha)+cos(alpha)*x+sin(alpha)*y, x0*sin(alpha)-y0*cos(alpha)-x*sin(alpha)+y*cos(alpha)
21  return iRT
22 
23 
24 def transform_points(x0, y0, angle):
25  # x0,y0 e' il punto da traslare, angle e' l'angolo del piano
26  # calcolo la rotazione del piano
27  rotation = 90-angle
28  inverse = -rotation
29  # proietto le coordinate (0,0) nel sistema di riferimento assoluto nel sistema di riferimento del punto
30  iRT = inverseRT(x0, y0, inverse)
31  (xc, yc) = iRT(0, 0)
32  #restituisco la funzione che transforma rispetto al piano xc yc angolato di alfa
33  return rototranslate(xc,yc,rotation)
rototranslation.transform_points
def transform_points(x0, y0, angle)
Definition: rototranslation.py:24
rototranslation.rototranslate
def rototranslate(x0, y0, angle)
Definition: rototranslation.py:4
rototranslation.inverseRT
def inverseRT(x0, y0, angle)
Definition: rototranslation.py:14


rose2
Author(s): Gabriele Somaschini, Matteo Luperto
autogenerated on Wed Jun 28 2023 02:21:53