SclInside
Overview
Determine the position of a point, inside, outside or on the perimeter of a closed segment, a closed string or a closed trisolation.
Synopsis
$segmentHandle SclInside $x $y
$stringHandle SclInside $x $y
$trisolationHandle SclInside $x $y $z
Description
This command determines the position of a point with respect a closed segment, string or trisolation. Note that if a string handle is used then all segments of the string must be closed. To be inside a string the point must be inside only one segment of the string.
Arguments
- segmentHandle, stringHandle, trisolationHandle
- x
- y
- z
This variable must contain the Scl object handle to either a segment, string or trisolation. The segment, string or trisolation must be closed for the SclInside command to execute successfully.
The X value of the point of interest.
The Y value of the point of interest.
The Z value of the point of interest. Note that the Z value is only required when used with a trisolation handle as the inside test for a segment and string are performed in the XY plane only and do not require a Z value.
Returns
An integer return value indicates the position of the point with respect to the segment, string or trisolation. Possible return values are:
- -1 - The point is exactly on the boundary of interest
- 0 - The point is outside the object of interest.
- 1 - The point is inside the object of interest.
Examples
set status [SclSelectPoint point "Select a closed segment" layer stringid segmentnum pointnum \
xp yp zp pointdesc]
if {$status == $SCL_OK} {
$point SclGetParent segment
set status [SclDigitise "Digitise a location inside the segment" x y z "(*)"]
if {$status == $SCL_OK} {
set inside [$segment SclInside $x $y]
if {$inside == 1} {
puts "Point is inside the boundary"
} elseif {$inside == 0 } {
puts "Point is outside the boundary"
} elseif {$inside == -1} {
puts "Point is exactly on the boundary"
} else {
puts "FATAL ERROR CONDITION - THIS SHOULD NEVER HAPPEN"
}
} else {
puts "selection cancelled"
}
} else {
puts "selection cancelled"
}
|
set status [SclSelectPoint point "Select a closed string" layer stringid segmentnum pointnum \
xp yp zp pointdesc]
if {$status == $SCL_OK} {
$point SclGetParent segment
$segment SclGetParent str
set status [SclDigitise "Digitise a location inside the string" x y z "(*)"]
if {$status == $SCL_OK} {
set inside [$str SclInside $x $y]
if {$inside == 1} {
puts "Point is inside the boundary"
} elseif {$inside == 0 } {
puts "Point is outside the boundary"
} elseif {$inside == -1} {
puts "Point is exactly on the boundary"
} else {
puts "FATAL ERROR CONDITION - THIS SHOULD NEVER HAPPEN"
}
} else {
puts "selection cancelled"
}
} else {
puts "selection cancelled"
}
|