MOHagen Posted September 25, 2020 Posted September 25, 2020 Hello, I would want to know if there is a easy / fast solution to check if a color exist on a line. I got two point, P1 (x:780, y:1280) and P2 (x: 1065, y:203) and I'm looking for the Blue color position (see below) On the purple line From P1 to P2 I want to get the position of the first occurrence of blue color (P3), some kind of ray casting. Is there a way to do it ? Thank you.
Developers Jos Posted September 25, 2020 Developers Posted September 25, 2020 3 minutes ago, MOHagen said: some kind of ray casting. which means what exactly? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MOHagen Posted September 25, 2020 Author Posted September 25, 2020 In fact it's pretty similar "casting or tracing" Like here for each line to get the first pos of the "green" match
Zedna Posted September 25, 2020 Posted September 25, 2020 (edited) Generally: Go in For/Next cycle from x1 to x2 pixel by pixel, calculate apropriate Y for that each X (some sin,cos math?) and use PixelGetColor(X,Y). EDIT: If it's 45° then Y calculation will be very simple: Y=Y1+(X-X1) Edited September 25, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
MOHagen Posted September 25, 2020 Author Posted September 25, 2020 Yes it is what I thought to just basically iterate on each point of the line but I wasn't sure it was the most efficient way (I'm pretty beginner with it then I'm not aware of all functionalities included
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