Mail Archives: djgpp/1998/10/17/09:30:19
From: | Ludvig Larsson <ludvig AT club-internet DOT fr>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: 3d sphere
|
Date: | Sat, 17 Oct 1998 05:57:23 +0200
|
Organization: | Faas-Goldhart
|
Lines: | 35
|
Message-ID: | <362815A3.6A2C@club-internet.fr>
|
References: | <703e0b$sts$1 AT supernews DOT com>
|
NNTP-Posting-Host: | toulouse-camichel5-132.club-internet.fr
|
Mime-Version: | 1.0
|
X-Trace: | front5.grolier.fr 908596724 26039 195.36.147.132 (17 Oct 1998 03:58:44 GMT)
|
NNTP-Posting-Date: | 17 Oct 1998 03:58:44 GMT
|
X-Mailer: | Mozilla 3.01C-CLUB (Win95; I)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
jud wrote:
>
> i came up with an idea of the idea of making a program that will draw a
> sphere out of a series of lines. This lines will be the size of the
> perimeter of the sphere. There will be the same amount of these "ribbons" as
> there are pixels in the hieght of the sphere.
>
> The problem here is i havent taken anything above algebra 1, although i have
> some basic ideas about sine cosine and arctangent funtions. A problem arises
> that if you take the half of the "ribbon" you have to make it shrink more
> and more as it geos from the middle of the sphere around, i dont know the
> formula to do this and i need it so i can show the sphere on the screen and
> have it look realistic
Phew...
I'll guess that maybe I can give you a hint...
If you are not speed dependen, make two loops:
loop b=0° to 180°
loop a=0° to 180°
ribbon=cos(b)
offset in ribbon=cos(a)
screenpos= (a,b)
offcourse you have to multiply a and b with different konstants,
bependin on how many ribbons you have, how big they are and the size of
the sphere on screen.
cos(a) and cos(b) witt ossilate between -1 and 1 so if you want a screen
x-size of 100, make screen_x=cos(a)*50+50;
Hop it helped(and hope it works, BTW, ordinary sin() and cos() works
with radians, radians=degrees*pi/180 so use sin(a*3.1415/180) etc).
Ludvig Larsson
- Raw text -