unction varargout = preview(varargin)

% PREVIEW M-file for preview.fig

% PREVIEW, by itself, creates a new PREVIEW or raises the

existing

% singleton*.

%

% H = PREVIEW returns the handle to a new PREVIEW or the handle

to

% the existing singleton*.

%

% PREVIEW('CALLBACK',hObject,eventData,handles,...) calls the

local

% function named CALLBACK in PREVIEW.M with the given input

arguments.

%

% PREVIEW('Property','Value',...) creates a new PREVIEW or

raises the

% existing singleton*. Starting from the left, property value

pairs are

% applied to the GUI before preview_OpeningFunction gets called.

An

% unrecognized property name or invalid value makes property

application

% stop. All inputs are passed to preview_OpeningFcn via

varargin.

%

% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows

only one

% instance to run (singleton)".

%

% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help preview

% Last Modified by GUIDE v2.5 06-May-2007 05:17:38

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @preview_OpeningFcn, ...

'gui_OutputFcn', @preview_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

gui_mainfcn(gui_State, varargin{:});

end% End initialization code - DO NOT EDIT

% --- Executes just before preview is made visible.

function preview_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% varargin command line arguments to preview (see VARARGIN)

%Xo=input('Enter the Table Width: ');

%Yo=input('Enter the Table Width: ');

%uiwait(hMainFigure);

% Choose default command line output for preview

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

% UIWAIT makes preview wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = preview_OutputFcn(hObject, eventdata, handles)

% varargout cell array for returning output args (see VARARGOUT);

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure

varargout{1} = handles.output;

% --- Executes during object creation, after setting all properties.

function text1_CreateFcn(hObject, eventdata, handles)

% hObject handle to text1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns

called

% --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

%delete(hMainFigure);

% --- Executes on

In article < XXXX@XXXXX.COM >,

[...]

Was there a question in there?

--

Is there any thing whereof it may be said, See, this is new? It hath

been already of old time, which was before us. -- Ecclesiastes

[...]

Was there a question in there?

--

Is there any thing whereof it may be said, See, this is new? It hath

been already of old time, which was before us. -- Ecclesiastes

ahihahi12345 wrote:

e=angle*pi/180; g=9.81;

Af=f*g;

To=Vo/Af;

s=(0:.1:2*pi);

r=0.02;

t=0.02;

P=Xo+i*Yo; % represent the positon of billiard

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

h=fill(x,y,rand(1,3));

set(h,'EraseMode','xor');

k=1;

Vx=Vo

while k

pause(0.1);

P=P+(Vx*t-(Af*t*t/2))*exp(i*e);

Vx=Vx-Af*t;

if real(P)<r;

P=2*r-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if real(P)>a-r;

P=2*(a-r)-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if imag(P)<r;

P=real(P)+i*(2*r-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if imag(P)>b-r;

P=real(P)+i*(2*(b-r)-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if Vx < 0;

k=0;

end

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

set(h,'xdata',x,'ydata',y,'facecolor',rand(1,3));

end

% --- Executes during object creation, after setting all properties.

function axes1_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns

called

I would like to ask,what can i do with the currentpoint or other

functions so that when i click on anywhere in the axes then the

billiard will appear on that position??

pls help.......

e=angle*pi/180; g=9.81;

Af=f*g;

To=Vo/Af;

s=(0:.1:2*pi);

r=0.02;

t=0.02;

P=Xo+i*Yo; % represent the positon of billiard

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

h=fill(x,y,rand(1,3));

set(h,'EraseMode','xor');

k=1;

Vx=Vo

while k

pause(0.1);

P=P+(Vx*t-(Af*t*t/2))*exp(i*e);

Vx=Vx-Af*t;

if real(P)<r;

P=2*r-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if real(P)>a-r;

P=2*(a-r)-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if imag(P)<r;

P=real(P)+i*(2*r-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if imag(P)>b-r;

P=real(P)+i*(2*(b-r)-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if Vx < 0;

k=0;

end

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

set(h,'xdata',x,'ydata',y,'facecolor',rand(1,3));

end

% --- Executes during object creation, after setting all properties.

function axes1_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns

called

I would like to ask,what can i do with the currentpoint or other

functions so that when i click on anywhere in the axes then the

billiard will appear on that position??

pls help.......

ahihahi12345 wrote:

e=angle*pi/180; g=9.81;

Af=f*g;

To=Vo/Af;

s=(0:.1:2*pi);

r=0.02;

t=0.02;

P=Xo+i*Yo; % represent the positon of billiard

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

h=fill(x,y,rand(1,3));

set(h,'EraseMode','xor');

k=1;

Vx=Vo

while k

pause(0.1);

P=P+(Vx*t-(Af*t*t/2))*exp(i*e);

Vx=Vx-Af*t;

if real(P)<r;

P=2*r-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if real(P)>a-r;

P=2*(a-r)-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if imag(P)<r;

P=real(P)+i*(2*r-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if imag(P)>b-r;

P=real(P)+i*(2*(b-r)-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if Vx < 0;

k=0;

end

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

set(h,'xdata',x,'ydata',y,'facecolor',rand(1,3));

end

% --- Executes during object creation, after setting all properties.

function axes1_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns

called

I would like to ask,what can i do with the currentpoint or other

functions so that when i click on anywhere in the axes then the

billiard will appear on that position??

pls help.......

e=angle*pi/180; g=9.81;

Af=f*g;

To=Vo/Af;

s=(0:.1:2*pi);

r=0.02;

t=0.02;

P=Xo+i*Yo; % represent the positon of billiard

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

h=fill(x,y,rand(1,3));

set(h,'EraseMode','xor');

k=1;

Vx=Vo

while k

pause(0.1);

P=P+(Vx*t-(Af*t*t/2))*exp(i*e);

Vx=Vx-Af*t;

if real(P)<r;

P=2*r-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if real(P)>a-r;

P=2*(a-r)-real(P)+i*(imag(P));

e=pi-rand*e;

Vx=c*Vx;

end

if imag(P)<r;

P=real(P)+i*(2*r-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if imag(P)>b-r;

P=real(P)+i*(2*(b-r)-imag(P));

e=-rand*e;

Vx=c*Vx;

end

if Vx < 0;

k=0;

end

x=real(P)+r*cos(s);

y=imag(P)+r*sin(s);

set(h,'xdata',x,'ydata',y,'facecolor',rand(1,3));

end

% --- Executes during object creation, after setting all properties.

function axes1_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns

called

I would like to ask,what can i do with the currentpoint or other

functions so that when i click on anywhere in the axes then the

billiard will appear on that position??

pls help.......

In article < XXXX@XXXXX.COM >,

Instead of setting Xo and Yo to the constants 0.5 0.5,

set them to the coordinates you obtained by using

get(gcf,'CurrentPoint') . For this to work properly, ensure that

your axis coordinates are normalized so that you get values

in the range 0 through 1. set(gca, 'Units', 'normalized')

The code section I extracted the above from was named as if it

were the callback for a pushbutton rather than for a mouse.

To convert it for use with the mouse, make that code the callback

for the figure ButtonDownFcn property.

set(gcf,'ButtonDownFcn',@DropABallCallback);

--

Prototypes are supertypes of their clones. -- maplesoft

Instead of setting Xo and Yo to the constants 0.5 0.5,

set them to the coordinates you obtained by using

get(gcf,'CurrentPoint') . For this to work properly, ensure that

your axis coordinates are normalized so that you get values

in the range 0 through 1. set(gca, 'Units', 'normalized')

The code section I extracted the above from was named as if it

were the callback for a pushbutton rather than for a mouse.

To convert it for use with the mouse, make that code the callback

for the figure ButtonDownFcn property.

set(gcf,'ButtonDownFcn',@DropABallCallback);

--

Prototypes are supertypes of their clones. -- maplesoft

thanx......it really helps....

another thing is,what should i do in order when i press on the axes

then the ball appear on that position and then i press again to

determine the angle for that ball to move in that direction with

respect to the angle??

i tried angle=tan(Yo/Xo) , but it seems not so accurate and a bit

weird....

thanx......

try atan, and you will have to figure out the quadrant since it will

only give you +/- pi/2 for return range.

with

bit

does anybody knows how to set the point (0,0) in the middle of the

axes?? so that i can try to set the quadrant......or anybody has any

idea regarding the

(( determine the angle for that ball to move in that direction with

respect to the angle?? ))

pls help.......

1. Press Release - Soft Xpansion presents Billiard Kings 2: New 3D billiard simulation for the PC

2. VB Menu GUI VB Menu GUI VB Menu GUI

3. Pool/Billiard Table with Microsoft Surface Technology

6. Everything about Champion Billiards

8. Terahertz Processors Coming Soon UsingBilliards

10. software rasterizer for 3d pool/billiard balls

12. SPAM: Everything about Champion Billiards

13. [OT] modeling billiard table

14. Terahertz Processors Coming Soon Using.Billiards

11 post • Page:**1** of **1**