GetNormalY#
NormalY# = GetNormalY#(PointIndex)
 
Parameters:

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

    NormalY# = The Y component of the normal vector
 

      The GetNormalY# functions returns the Y 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,7)
        
        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# | GetNormalX# | LineIntersectCircle | PointIntersectCircle | RayHitSprite | SpriteCollisionMode :
 


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