|
LineIntersectCircle | |
Result = LineIntersectCircle(X1, Y1, X2, Y2, CircleX, CircleY, Radius, [CalcImpacts=0]) | |
Parameters: X1 = The starting X coordinate of the line Y1 = The starting Y coordinate of the line X2 = The ending X coordinate of the line Y2 = The ending Y coordinate of the line CircleX = X-position of the circle CircleY = Y-position of the circle Radius= radius of the circle [CalcImpacts=0] = Flag to calc the intersection points or normals |
|
Returns: Result |
|
LineIntersectCircle checks if a line intersects a circle. The function returns the number of impacts the line makes with the circle edges. The function offers various detection modes, when can be controlled using the CalcImpacts parameter. CalcImpacts Settings: The LineIntersectCircle treats that calc impacts parameter as 4 bit switches. Bits 0 & 1 control the first and second impacts points and bits 2 & 3 control the normals. Giving us 16 possible combinations. Here's the first 8, 0 = Don't calculate any impact coordinates or normals 1 = Calc first impact coordinate. 2 = Calc second impact coordinate (if it exists). 3 = Calc the first and second impacts 4 = Calc Normal of the first impact. 1+4 = Calc Impact and Normal of first impact. 2+4 = Calc Impact of Second point and Normal of first. 1+2+4 = Calc Impact of First + Second point and Normal of first. 1+2+4 = Calc Impact of First + Second point and Normal of first. 8 = Calc the Normal of the second impact. 1+8 = Calc first impact, with the Normal of the second impact. FACTS: * When impacts coordinates are required, they can be accessed using the GetIntersectX#(), GetIntersectY#() and the GetNormalX# & Y functions respectively. Mini Tutorial: Show the use of LineIntersectCircle
|
Related Info: | CirclesIntersect | GetIntersectX# | GetIntersectY# | GetNormalX# | GetNormalY# | LineIntersectRect | LinesIntersect | PointInBox | PointIntersectCircle : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |