brain teaser

new topic     » topic index » view thread      » older message » newer message

------=_NextPart_000_0005_01BE9B38.1D283240
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all, Col22 here with
a little programming brain teaser for you.

I have been scribbling a little 3d engine recently, and without sending=20
you to sleep with the details I had this little problem in the middle.

I have a player facing angle called playera.
I have a x viewing angle called viewang
I have various angles to check "ang",
if they are in the feild of view, viewang.
The angles playera and viewang are in degrees.
veiwang can be from 45 to 180
playera can be from 1 to 360

There's the background, heres the puzzle.
Fill in the missing condition to make the code find if=20
the angle "ang" is within the given range minang to maxang.


minang =3D playera - veiwang / 2
maxang =3D playera + veiwang / 2
if xxxxx missing condition xxxxx then=20
    blah
    blah
end if

.....................................................

I have done this a few ways but am not happy with them.
I feel there is a concise and efficient way of doing it=20
but it escapes me for the moment.
Whatever you come up with as a solution I would be happy
to hear from you. Thanks, Col22


------=_NextPart_000_0005_01BE9B38.1D283240
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all, Col22 here with<BR>a little =
programming=20
brain teaser for you.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have been scribbling a little 3d =
engine recently,=20
and without sending <BR>you to sleep with the details I had this little =
problem=20
in the middle.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have a player facing angle called =
playera.<BR>I=20
have a x viewing angle called viewang<BR>I have various angles to check=20
"ang",<BR>if they are in the feild of view, viewang.<BR>The angles =
playera and=20
viewang are in degrees.<BR>veiwang can be from 45 to 180<BR>playera can =
be from=20
1 to 360</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>There's the background, heres the =
puzzle.<BR>Fill=20
in the missing condition to make the code find if <BR>the angle "ang" is =
within=20
the given range minang to maxang.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>minang =3D playera - veiwang / =
2<BR>maxang =3D=20
playera + veiwang / 2<BR>if xxxxx missing condition xxxxx then=20
<BR>&nbsp;&nbsp;&nbsp; blah<BR>&nbsp;&nbsp;&nbsp; blah<BR>end =
if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
V>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have done this a few ways but am not =
happy with=20
them.<BR>I feel there is a concise and efficient way of doing it <BR>but =
it=20
escapes me for the moment.<BR>Whatever you come up with as a solution I =
would be=20

------=_NextPart_000_0005_01BE9B38.1D283240--

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu