GetNormalX#
NormalX# = GetNormalX#(PointIndex)
 
Parameters:

    PointIndex = The index of intersection point you wish to read
Returns:

    NormalX# = The X component of the normal vector
 

      The GetNormalX# functions returns the X component of the normal vector from a previous intersection calculation.



FACTS:


      * None




Mini Tutorial:


      This example shows how to detect an intersection (between a ray and a circle), then display the intersection point and normal.


  
  
; Calculate position of main circle
  HCentre = GetScreenWidth() / 2
  VCentre = GetScreenHeight() / 2
  
; Begin program main repeat/until loop
  Repeat
     Cls RGB(0,0,0)
   ; Draw a circle
     Circle HCentre, VCentre, 400
     
     mx#=MouseX()
     my#=MouseY()
     
   ; Draw a line from 0,0 to Mouse position
     Line 2020, mx#,my#
     
   ; Check for Intersection
     If LineIntersectCircle(20 , 20, mx#, my#, HCentre, VCentre, 40,1)
        
        Print "Line Intersected Circle"
        ix#=GetIntersectX#(0)
        iy#=GetIntersectY#(0)
        
      ; draw a read circle to show the intersection point
        CircleC ix#,iy#,5,1,RGB(255,0,0)
        
      ; Project a ray in the intersection points normal
        x2#=ix#+(GetNormalX#(0)*50)
        y2#=iy#+(GetNormalY#(0)*50)
        
        LineC ix#,iy#,x2#,y2#,RGB(0,0,255)
        
        
     EndIf
     Sync
  Until EscKey()
  









 
Related Info: CirclesIntersect | GetIntersectX# | GetIntersectY# | GetNormalY# | PointIntersectCircle | RayHitSprite | SpriteCollisionMode :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com