Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: help with trig(?) calculation

  • To: mathgroup at
  • Subject: [mg13234] Re: [mg13155] help with trig(?) calculation
  • From: Robert Pratt <rpratt at>
  • Date: Fri, 17 Jul 1998 03:17:34 -0400
  • Sender: owner-wri-mathgroup at

Unless your screen is square (which I doubt), the example (320,240) 
with 45 degrees hits the point (560,0), not (640,0).  Use the angle 
ArcTan[240/320]=ArcTan[3/4] if you want to hit (640,0).

The following commands seem to do what you want, if you enter alpha  in
radians (convert if necessary).

WithinBoundaryQ[{x_,y_}]:=(0<=x<=640) && (0<=y<=480)


intersect[{320,240},45 Pi/180]




intersect[{320,0},3 Pi/2]




Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill CB# 3250, 331 Phillips
Chapel Hill, NC  27599-3250

rpratt at

On Mon, 13 Jul 1998, Leon Bryant wrote:

> i need some help from the "gurus". i am a multimedia programmer working
> in San Antonio, and need help with a programming idea that involves
> some simple(?) trig.
> the problem:
> i have a display area (computer screen) that has the dimensions 640 by
> 480 units (pixels).
> my program sets the dimensions of this rectangle to:
> TL - 0,0
> TR - 640,0
> BL - 0,480
> BR - 640,480
> what i would like to do is give the coordinates of a point on the
> screen, an angle (or a second point), and devise an algorithm that will
> plot where the imaginary line would inintersect the boundaries of the
> display area. 
> for instance:
> point:  (320,240) (centered on screen) angle: 45 degrees
> intersection point: (640,0)
> this one's intuitive since the starting point is centered on the screen,
> and the angle is 25% of 360 degrees, but i'm stumped with anything more
> irregular.
> can you explain how i'd do this? can it be put into a simple formual?
> email: leon.bryant at

  • Prev by Date: Re: Can it be done - easily?
  • Next by Date: Re: Limit doesn't work properly
  • Previous by thread: help with trig(?) calculation
  • Next by thread: Problems with numerical precision