Code covered by the BSD License
-
params(varargin)
PARAMS M-file for params.fig
-
throw_body
velocity:
-
bdf(hfl)
Button Down Function
-
buf
reset hystory:
-
hfl=create_object(x,y,r,no)
create movable with mouse object
-
move(hfl,xp,yp,xd,yd,kkx,kky,...
makes move
-
ret_body
return body
-
update_in_main
-
run_me.m
-
View all files
from
throw body with mouse
by Maxim Vedenyov
It throws body in gravitation. Initial velocity defined by pointer velocity.
|
| hfl=create_object(x,y,r,no)
|
function hfl=create_object(x,y,r,no)
global ha c
% create movable with mouse object
% ha - axes handler
% (x,y) - object position
% r - object radius
% c - object color
% no - object number
% draw marker as circle:
nr=12; % resolution
al=0:pi/nr:(2*pi-pi/nr);
xa=x+r*cos(al);
ya=y+r*sin(al);
hfl=fill(xa,ya,c,'parent',ha);
% what to do if ckicked:
set(hfl,'ButtonDownFcn',['bdf(' num2str(hfl,'%20.20f') ')']);
set(hfl,'Userdata',no); % memorize number
|
|
Contact us at files@mathworks.com