DEKTEN

SBF_CliHor

Mar 24th, 2021 (edited)
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.09 KB | None | 0 0
  1.     //: Horizontal Intersection Of Point And Circle
  2.     //: www.twitch.com/kanjicoder
  3.     //: https://www.etsy.com/shop/DekTen
  4.     //: ANIMATED_GIF_OF_THIS_CODE: https://imgur.com/gallery/wIPuIES
  5.  
  6.     //:COPIED_FROM[ R:\G\UP\MSB\SBF.SCAD ]===================://
  7.  
  8.         //:Circle_Line_Intersect:HORIZONTAL_RAY_FROM_POINT
  9.         function SBF_CliHor(
  10.             p_t
  11.         ,   cen
  12.         ,   rad
  13.         )=([
  14.             ( //:<<<<<<< h_x:HIT_X(intersection_x)
  15.  
  16.                 ( cen[0]+SBF_IGT(p_t[0],cen[0])*cos( //:C_F:BEG
  17.  
  18.                     asin((p_t[1]-cen[1])/rad)  //:__ANG__
  19.  
  20.                 )*rad )  //:<<<<<<<<<<<<<<<<<<<<<<<<<<<:C_F:END
  21.  
  22.             ) //:<<<<<<< h_x:HIT_X(intersection_x)
  23.             ,
  24.             p_t[1] //:Y_IS_SAME_FOR_HORIZONTAL_INTERSECTION
  25.         ]);;
  26.  
  27.         //: IGT:Is_Greater_Than:
  28.         //:     TRUE: Return 0+1
  29.         //:    FALSE: Return 0-1
  30.         function
  31.         SBF_IGT( p_t , cen )=(
  32.  
  33.             p_t >= cen ? 0+1 :
  34.             p_t <  cen ? 0-1 : 0
  35.  
  36.         );;
  37.  
  38.     //:==================:COPIED_FROM[ R:\G\UP\MSB\SBF.SCAD ]://
Add Comment
Please, Sign In to add comment