Effacer les filtres
Effacer les filtres

how can I draw a line knowing just the midpoint and the angle?

4 vues (au cours des 30 derniers jours)
Mark
Mark le 17 Mar 2015
Commenté : Mark le 17 Mar 2015
how can I draw a line knowing just the midpoint and the angle?

Réponse acceptée

Hugo
Hugo le 17 Mar 2015
You can do this
midpoint=[a,b]; % This defines the midpoint. You should give a and b some value. lineangle=c; % This defines the angle. Use this if your angle is in radians. lineangle=c*pi/180; % This defines the angle. Use this if your angle is in degrees.
L=1; % This defines the length of the line
x=[-.5,.5]*L*cos(angle)+midpoint(1); y=[-.5,.5]*L*sin(angle)+midpoint(2); plot(x,y);
That's all
Hope this helps.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by