6600arac@ucsbuxa.ucsb.edu (Kenneth Mencher) (11/20/90)
Okay peoples. I'm working on a 3-d Rotation program that uses spherical co-ordinates. Part of it involves using the arccos function. Unfortunately, Turbo Pascal doesn't have one. I'd appreciate any help you can give me, from whole functions to hints. Thanx in advance. Arachnid 'Not to old to Rock and Roll, Not to young to die'
bobb@vice.ICO.TEK.COM (Bob Beauchaine) (11/20/90)
In article <7300@hub.ucsb.edu> 6600arac@ucsbuxa.ucsb.edu (Kenneth Mencher) writes: >Okay peoples. I'm working on a 3-d Rotation program >that uses spherical co-ordinates. Part of it >involves using the arccos function. Unfortunately, >Turbo Pascal doesn't have one. > >I'd appreciate any help you can give me, from whole >functions to hints. > From _CRC_Standard_Mathematical_Tables Arccos(x) = PI/2 - Arctan(x /sqrt(1 - x*x)) Arcsin(x) = Arctan(x/sqrt(1-x*x)) All angles returned are, of course, principle angles. Bob Beauchaine bobb@vice.ICO.TEK.COM
zhou@brazil.psych.purdue.edu (Albert Zhou) (11/20/90)
Try to get arccos from arctan which is in TP.
T.Moore@massey.ac.nz (T. Moore) (11/20/90)
>Okay peoples. I'm working on a 3-d Rotation program >that uses spherical co-ordinates. Part of it >involves using the arccos function. Unfortunately, >Turbo Pascal doesn't have one. Arccos(x) = PI/2 - Arctan(x /sqrt(1 - x*x)) Arcsin(x) = Arctan(x/sqrt(1-x*x)) All angles returned are, of course, principle angles. Bob Beauchaine This is fine, so long as your picture is not too complicated. Otherwise you will find it incredibly slow. Some people have resorted to assembler for things like this but, even in Pascal, you can speed things up a lot by using a table of sines and cosines. -- Terry Moore <T.Moore@massey.ac.nz> Department of Mathematics and Statisics, Massey University, Palmerston North, New Zealand Kroneker: "God made the natural numbers, the rest is the work of man." Zermelo: "But I can construct the natural from the empty set alone." Bystander: "Who said 'You can't get something for nothing.'?"
soper@maxzilla.encore.com (Pete Soper) (11/20/90)
From article <1990Nov19.235515.24772@massey.ac.nz>, by T.Moore@massey.ac.nz (T. Moore): >> Arccos(x) = PI/2 - Arctan(x /sqrt(1 - x*x)) >> Arcsin(x) = Arctan(x/sqrt(1-x*x)) >> All angles returned are, of course, principle angles. >> Bob Beauchaine > > This is fine, so long as your picture is not too complicated. Otherwise But think of how many pictures he can process in the time it would take to implement an optimal arccos function. So while he is using this derived function he has got the freedom of time to make it fast, either with tables or a full implementation using something like Cody and Waite. Sorry for the deletions but my mailer is ruthless about posted vs followups. ----------------------------------------------------------------------- Pete Soper (soper@encore.com) +1 919 481 3730 Encore Computer Corp, 901 Kildaire Farm Rd, bldg D, Cary, NC 27511 USA