POV-Ray : Newsgroups : povray.general : Re: Math help please. : Re: Math help please. Server Time
19 Nov 2024 05:25:56 EST (-0500)
  Re: Math help please.  
From: Sir Charles W  Shults III
Date: 19 Apr 2002 09:08:24
Message: <3cc016c8$1@news.povray.org>
You must know the angle in order to solve this.  Any triangle can be solved
knowing "side-angle-side" through simple trigonometry.  But the simpler approach
has nothing to do with any of this.  If you know point A and you know point C,
you have your answer through (as you guessed it) the Pythagorean theorem.  Let's
assume that point A is represented by (x1,y1) and point C is represented by (x2,
y2).  Then the distance from A to C is very simple:

    X = (x2-x1)
    Y = (y2-y1)
    D = sqrt((X*X) + (Y*Y))

    Since X may be negative or positive (and also the same is true for Y), you
may expect to take an absolute value or something, but this is not necessary.
Squaring the term automatically resolves it as a positive value.  The square
root of the sums of the squares gives the distance.

Cheers!

Chip Shults
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.