VARKON Version 1.18 2005-08-02
pos_in_cone - Function
Geometrical function
Description
Tests if one or more of a number of positions are inside or outside a cone.
Syntax
pos_in_cone(p1, p2, r1, r2, npos, positions, pstatus)
VECTOR
p1; VECTOR
p2; FLOAT
r1; FLOAT
r2;
INT
npos;
VECTOR
positions();
INT
pstatus();
Principal parameters
p1
- Cone start position
p2
- Cone end position
r1
- Cone radius at start position
r2
- Cone radius at end position
npos
- Number of positions to test
positions
- An array of at least npos position vectors
Optional parameters
pstatus
- Array to recieve the individual status of each position, 1 = Inside, 0 = Outside
Return value
An INT value = 1 if one or more of the positions are inside the cone. If no positions are inside zero is returned.
Example
INT status,pstatus(500);
VECTOR p1,p2,p(500);
FLOAT r1,r2;
status:=pts_in_cone(p1,p2,r1,r2,500,p);
Tests 500 3D positions in p against a cone starting in p1 with radius r1 and ending in p2 with radius r2. If one or more of the points are located inside the cone a value of 1 is returned in variable status, else zero is returned.
status:=pts_in_cone(p1,p2,r1,r2,500,p,pstatus);Same as above but in this example each position is classified individually and it's status is returned. pstatus(1) holds the status for the position in p(1), pstatus(2) corresponds to p(2) etc. A value of 1 means that the position is inside the cone, a value of 0 means that it is outside.
Comments
This function was developed for the CAD reserach group at Örebro university in Sweden. It is used in an automatic planning algorithm for laser scanning to find points that are close to a given point in a specific direction.