EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Tip List

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #237 background imageLoading...
Page #237 background image
return
abs((at-(tArea(px,py,bx,by,cx,cy)+tArea(ax,ay,px,py,cx,cy)+tArea(ax,ay,bx,by,px,
py)))/at)tol
EndFunc
The function returns true if point (px,py) is within the triangle defined by the points (ax,ay), (bx,by) and
(cx,cy), otherwise it returns false. tol is a small positive number which specifies the tolerance at which
the two areas will be considered equal. If you are using Exact mode, you may set tol = 0. If you are
using the function in Approx mode, with floating point coordinate arguments, set tol to specify the
precision at which you want to consider the two areas equal. This will depend on your application. If,
for example, you want to assume that the point P is in triangle ABC if the two areas are the same to six
significant digits, then set tol = 1E-6. A safe minimum value for tol is 1E-12, since the 89/92+ results
are accurate to about 12 significant digits.
Note that I use a relative tolerance, not an absolute tolerance. This is necessary because the point
coordinates may have a wide range. For example, suppose that the three triangle points are (0,0),
(0,2E20) and (1E20,1E20), and we want to determine if point P = (-1E10,-1E10) is in the triangle. The
area of ABC is 1E40, and the sum of the areas of the three triangles including P is 1.0000000002E40.
The absolute difference between the two areas is 2E30, but the relative difference is 2E-10. If we call
PntTrian() with tol = 1E-12, it will correctly return false in this case.
Disregarding the tolerance, points at the triangle vertices and on the lines joining the vertices are
considered inside the triangle.
As an example, suppose we have a triangle with vertices at (0,0), (7,0) and (4,4). Which of the points
(4,1), (5,3) and (2,2) are within the triangle? We will use exact mode and tol = 0, so the function calls
are
PntTrian(4,1,0,0,7,0,4,4,0) returns true
PntTrian(5,3,0,0,7,0,4,4,0) returns false
PntTrian(2,2,0,0,7,0,4,4,0) returns true
So the first and third points are in the triangle, but the second point is not. Note that the third point is on
a triangle edge.
The idea for this tip was taken from a Design Idea in the August 3, 2000 issue of Electronic Design
News magazine, titled Algorithm tests for point location, by Lawrence Arendt, of the Mannitoba HVDC
Research Centre, Winnipeg, Canada.
[6.46] solve() and nsolve() ignore constraints with local variables
(Applies to AMS 2.05)
Constraint expressions are used with solve() and nsolve() to limit the solution range for the
independent variable. This shortens the solution time, and also narrows the search to the desired root
if the function has more than one. For example, the constraint expression "|x>1 and x<2" in this
example
nsolve(f(x)=0,x)|x>1 and x<2
should return a single solution between x=1 and x=2.
6 - 79

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals