ScratchData LogoScratchData
Back to Snow-Cannon_Test's profile

Line Detection 2

SNSnow-Cannon_Test•Created December 18, 2017
Line Detection 2
3
3
54 views
View on Scratch

Description

Trying out line detection method This is the result. It uses the same principle as my first line detection, but with the 2 corners of the hit box. By taking the 2 corners of the hit box, you can use the slope formula to see if the box has the outer lines overlapping the intersection points, and if so, you are touching it. but you only need 2 corners to get 4 sides, halving the number of calculations I thought necessary. However, if the line you are detecting has a backwards slope, you have to change the points to the top right and bottom left instead, as that gives you the proper locations to overlap. TO DO: Improve line width calculations

Project Details

Project ID194165108
CreatedDecember 18, 2017
Last ModifiedDecember 19, 2017
SharedDecember 18, 2017
Visibilityvisible
CommentsAllowed