cs8898 Posted January 3, 2013 Share Posted January 3, 2013 hy, all i want to check if, the mouse is over an triangle, but to create 100lines of code is a very bad scripting style, is there any, other chance to find out that the mouse is over the triangle Sorry for my worse English Link to comment
iPrestege Posted January 3, 2013 Share Posted January 3, 2013 What do you mean? Above the triangle? Explain more . Link to comment
cs8898 Posted January 3, 2013 Author Share Posted January 3, 2013 i wanna to write a radial Menu, so i would draw a circle with dxDrawLine(); then i want to create some peaces, like that but i hade to check that the mouse iv over or isnt over a section of the circle Link to comment
Alen141 Posted January 3, 2013 Share Posted January 3, 2013 Why don't you make it on click it makes it easier Link to comment
cs8898 Posted January 3, 2013 Author Share Posted January 3, 2013 i will make it with the standard GUI functions, and with them i could use Rectangle, that woud be easyer Link to comment
cs8898 Posted January 3, 2013 Author Share Posted January 3, 2013 I found something but i cant get it, my for some others http://www.blackpawn.com/texts/pointinpoly/default.html Link to comment
50p Posted January 3, 2013 Share Posted January 3, 2013 You can try this (I haven't tested it): function isPointInTriangle( x,y, x1,y1, x2,y2, x3,y3 ) if sign( x,y, x1,y1, x2,y2 ) < 0 or sign( x,y, x2,y2, x3,y3 ) < 0 or sign( x,y, x3,y3, x1,y1 ) < 0 then return false; end return true; end function sign( x1,y1, x2,y2, x3,y3) return (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3); end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now