The online racing simulator
LFS Polygon Draw (html+js)
(58 posts, started )
LFS Polygon Draw (html+js)
Use LFS Polygon Draw to identify new areas (streets) without the use of nodes on opened track like FEX FEY (LFS Z30 or higher)
used jsDraw2D - http://jsdraw2d.jsfiction.com/
use FireFox, Chrome

Update:
add: json style output
add: multipoligon drawing

Site where u can draw polygons

GitHub

C++ code to find point in polygon


<?php 
x
,curent position

polyX
[] - array of X polygon points
polyY
[] - array of Y polygon points

polySides 
count of points

bool checkPosition
(int polySides,int polyX[],int polyY[],int x,int y)
{

    
int    ij=polySides-;
    
bool  oddNodes=false     ;

    for (
i=0i<polySidesi++)
    {
        if (
polyY[i]<&& polyY[j]>=y
                
||  polyY[j]<&& polyY[i]>=y)
        {
            if (
polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x)
            {
                
oddNodes=!oddNodes;
            }
        }
        
j=i;
    }
    return 
oddNodes;
}
?>

#2 - PoVo
Great work! I'll use it Simple tool.

Only problem I have is I can't make the green point smaller.

It says the size is "1". I tried changing it to 0.2 and it doesn't work
i think.... just dont use this =)
great tool however in 1 pixel means 65535 in the value?
can u make it zoom-able version? i can't see it very well (glasses)
skywatcher122, use ctrl + mouse_scroll
hmm, i found bug.. convert js_coordinates to game_coordinates.
fixed
can u create a square tool like in paint so i can draw squares rather than polygon draw?
Sorry for Bump, but it doesn't work by me, and I have no idea to get work it.
If I draw an area, I get a different X and Y cordinates instead of what lfs gives.

And with that code, I get errors.
Coords of Polygon Draw = MCI Coords / 65536.
Coords of MCI = Polygon Draw Coords * 65536.
As far as I can remember now without looking into my code...
Could be 65536, could be 4096. Try for yourself
Sorry for bumping this up, but how do i use this tool?
I really can't understand it

Could anyone help me please?
You can draw a polygon with it...

For example a rectangle. Just click four points on the track map in a clockwise direction and press 'fill polygon'.

Then it makes the area blue and it gives a set of coordinates which you then can use if a car is in that area or not depending on the info of a MCI InSim packet (and those coordinates are / 65536).

I just sound very wise now but I just figured that out today.
Ex: I used 18 points, now it gaveme:


202;364
210;390
222;429
238;446
259;439
276;418
288;382
282;355
300;349
303;381
294;422
269;446
242;466
231;460
209;441
193;400
187;363


Now how i work with this ?
Bump
And what is it you want to achieve? This tool only gives you coordinates of points on the track in a format that LFS understands. It's really up to you how you use this...
Cansomeone make a tutorial to how to make this? Thanks all
Quote from AlvaroPT :Cansomeone make a tutorial to how to make this? Thanks all

Learn HTML + Javascript + insim.txt
#18 - PoVo
Oh, thanks
Could somebody please shed a bit more light on how this actually works? Ive created the various polygons around the map that i need, now it outputs values for x and y but how do i identify which is which?
-
Skinning (lkr3) DELETED by Flame CZE : asking for your skin to be uploaded at lfsworld is not allowed
-
(Denny12) DELETED by Flame CZE : reply to a deleted post
i'm add some JSON support.
#22 - PoVo
Quote from denis-takumi :i'm add some JSON support.

Very nice feature I had something similar implemented on my local copy but never thought of uploading it.
in future i want create mega editor =)
Quote from denis-takumi :i'm add some JSON support.

think I found a bug in JSON export, Y coordinates have inverted values
Propably it's not bug. LFS have inverted Y axis in coordinates.

LFS Polygon Draw (html+js)
(58 posts, started )
FGED GREDG RDFGDR GSFDG