Make axis reflective so line moves in opposite direction
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Aarav Shah
il 29 Nov 2019
Risposto: Walter Roberson
il 29 Nov 2019
I have a line that is plotted using user input:
plot(xClic, yClic,'');
hold on
% Compute y intercept for slope of 1
b = yClic*xClic;
% Plot the line between the click point and the y intercept
batBeam=plot([xClic,0],[yClic,b],'b');
The limit of the x and y axis is 100. The line stops plotting when x=0 and y=whatever or when x=whatever and y=0.
How do I make a reflective boundary that activates once the line ends at (0,y) or (x,0) that stops after two bounces. For trouble visualizing, think of a laser boucing off a mirror.
This should happen at the endpoint. The line should have the same slope and move in the opposite direction.
0 Commenti
Risposta accettata
Walter Roberson
il 29 Nov 2019
You cannot do what you are asking. It is not possible to get an event from the instant that the on-screen drawing of a line reaches a certain point on the screen. The MATLAB graphic system sends coordinate lists of complete lines to the hardware graphic system, which renders the coordinates and flips to new screens all at once (except as needed to transfer rendered information to the display.)
What you will have to do instead is to calculate the point of interception and act upon it appropriately.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Performance in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!