Borrar filtros
Borrar filtros

How to apply rotation on last few points ?

1 visualización (últimos 30 días)
Muhammad Iqbal
Muhammad Iqbal el 18 de Ag. de 2020
Comentada: KSSV el 18 de Ag. de 2020
I have 5 points but try to rotate the last few points not all
here is the code :
theta = 10;
R = [cosd(theta) -sind(theta) 0 ;
sind(theta) cosd(theta) 0;
0 0 1];
initialPoints = [ 0 0 0;
15 0 0;
30 0 0;
45 0 0;
60 0 0];
Rotation=initialPoints *R;
the above code work well and rotate all points abut i want to apply rotataion only for last two steps ,can somebody suggest me how can i do that ?
thanks in advance

Respuesta aceptada

KSSV
KSSV el 18 de Ag. de 2020
To rotate only last two points, you can use.
Rotation=initialPoints(end-2:end,:) *R;
  2 comentarios
Muhammad Iqbal
Muhammad Iqbal el 18 de Ag. de 2020
Hi KSSV;
thanks for your immediate feedback ,it found that the above code vanish the initial points (0 0 0,15 0 0)and rotate the whole road segments ( that contains my points basically )like
i want the ego vehicle move from point A to B in straight initillaly on the road then rotate the road segmemts(contains points) at specific degree so that the ego vehicel also follow the rotated direction
your suggestions will be highly appreciated ,
best regards
KSSV
KSSV el 18 de Ag. de 2020
theta = 10;
R = [cosd(theta) -sind(theta) 0 ;
sind(theta) cosd(theta) 0;
0 0 1];
initialPoints = [ 0 0 0;
15 0 0;
30 0 0;
45 0 0;
60 0 0];
Rotation=initialPoints(end,:)*R;
R = initialPoints ;
R(end,:) = Rotation ;
I = initialPoints ;
plot(I(:,1),I(:,2),'LineWidth',10) ;
hold on
plot(R(:,1),R(:,2),'LineWidth',10) ;

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by