Back | Close Window

Manipulating Points

This subject has more depth than what I present here as a basic intro.  I welcome others to comment and add their points of view.

Point data has a different data structure.  Each DB point has 3
components; X, Y, and Z distances from absolute zero (A(0,0,0)).  Each one of these components can be individually accessed by:

005

     p1 = (2,4,6)
006     rx = p1.x  /* =2
007     ry = p1.y  /* =4
008     rz = p1.z  /* =6

A pixel point will only have the X and Y components.  Additionally, the data structure of a point has an index value.  Some $utilities will set this index value to #none, depending on the success or failure of the $utility.  This index value can be accessed by:

009     p1 = $fndpt(p2)
010     if p1.i == #none
011             $ferror(0,'Point Not Found')
012     endif


Vectors

Every point defines a
vector from A(0,0,0).  Each point vector has a length, a rotation angle about the Z-axis, and an elevation angle above/below the work plane.  A unit vector is identical, but always has a length of one unit (foot? meter? who cares? - they are used to simplify the process of calculation angles and elevations).


Operators

The basic operators include
multiplication (*), division (/), addition (+), and subtraction (-) with the following rules: 013     p1 = (2,4,6)
014     p2 = (1,3,3)
015     p  = p1+p2              /* = (3,7,9)
016     p  = p1-p2              /* = (1,1,3)
017     p  = p1*2               /* = (4,8,12)
018     p  = p1/2               /* = (1,2,3)
019     p  = p1+7               /* = (9,4,6)
020     p  = p1+(7,5,0) /* = (9,9,6)

Tip:  By adding 2 points and dividing the resulting point in half - you have determined the mid point between the original 2 points (pmid = ((p1+p2)/2)).


Evaluation Order

Same as in lesson #010 - Manipulating Numbers.


Dot Operators

Dot operators perform specialize functions(degrees is a real number value):

point = point1 .rtx. degrees & point = point1 .rty. degrees & point = point1 .rtz. degrees
Rotates the point around an axis the specified number of degrees.
021     p = A(1,0,0).rtz.90 /* p=A(0,1,0)
022     p = A(1,0,0).rty.90 /* p=A(0,0,1)

point1 .dot. point2
Used in vector analysis.  If anyone else wants to elaborate, please do.

point1 .cross. point2
Used in vector analysis.  If anyone else wants to elaborate, please do.


$utilities

There are numerous $utilities that deal with points.  I'll just quickly list them here, leaving the exploration to you and a much later lesson.

                Returns:
$cenpt()        Center point based on the 3 specified points
$colin()        Determines if the 3 specified points are colinear
$hand() Determines for p3 - which side of the line p1-p2 it falls on
$len()          3D length from p1 to A0
$len2() 2D length from p1 to A0
$lint()         Intersection data about 2 specified line segments
$perp() Perpendicular foot from p1 on line p2-p3


That's all for now,
Steve

I would like to thank Jeff Small for his addition on lesson #003, using a "make" file in UNIX and for pointing out that for every time you compile your sigmac - you need to reload the sigmac library in ARRIS for your changes to take affect. I welcome all the help I can get.

This lesson was brought to you by SCG consulting. All written materials related to these Sigmac lessons are copyrighted by SCG and intended for personal use only. Any commercial or non-commercial reproduction for public use is prohibited without written consent from SCG.

Back | Close Window