The online racing simulator
LFS Polygon Draw (html+js)
(60 posts, started )
i draw all polygnons and i don't know how to use it ;-;
sad
I fixed a bug when canvas not show in "Polygon2"
upd: color selector
fix: polygon splash color
add: github lick
upd: support new westhill
Just curious, Since this was a originally HTML+JS, was kinda curious why you added in PHP, the stuff that was done with PHP could have easily been done with something like AngularJS(probably regular JS too)
most likely due to the fact that in my life except php can not see anything =)

replace to html =)
I think the new redesign looks good. Smile
hello, how to draw, and how to use taht c++ code ?
Enyone?
Quote from denis-takumi :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;
}
?>


Can it be done for c# please it will really help me

<?php 
public static bool Check_Pos(int polySidesint[] polyXint[] polyY,float x,float y)
{
int ipolySides 1;
bool oddNodes false;

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

int[] array = new int[] { 1357};
bool Check_Pos(int polySides,int[] polyX,int[] polyY,int x,int y);
?>

thank you
Quote from denis-takumi :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;
}
?>


a nice feature would be a list of "layers" if I can call it that. Just like in photoshop, once you've filled a Polygon in a layer, it'll stay in that layer, and if the layer gets deleted, the polygons in that layer will also disappear. Will also make it easier to use this tool.

EDIT: I tried to place some points and areas, and then press "Clear Previous Points", but nothing's happening.
Added RO into select
Quote from kristofferandersen :a nice feature would be a list of "layers" if I can call it that. Just like in photoshop, once you've filled a Polygon in a layer, it'll stay in that layer, and if the layer gets deleted, the polygons in that layer will also disappear. Will also make it easier to use this tool.

its good idea, but i dont have time =)
Good news for everyone! i updated tool.
Whats new:
- Add layer system.
- You can add/move/delete points for every layer
- Replaced Color from selector to html5 colorpicker
- save only json output (in php, c++, c# you can use extentions)
- for cruise makers added streetname and speedlimit inputs (included to export)
- move project site to GitHub.io
Quote from denis-takumi :Good news for everyone! i updated tool.
Whats new:
- Add layer system.
- You can add/move/delete points for every layer
- Replaced Color from selector to html5 colorpicker
- save only json output (in php, c++, c# you can use extentions)
- for cruise makers added streetname and speedlimit inputs (included to export)
- move project site to GitHub.io

Nice! Big grin
I can't understand how x and y works..

if (((Conn.CompCar.X / 65536) <= -65) && ((Conn.CompCar.X / 65536) >= -116) && ((Conn.CompCar.Y / 65536) <= 219) && ((Conn.CompCar.Y / 65536) >= -46))

If I have x1,x2 and y1,y2 where need to put x1 x2 y1 y2 ?? Is on code first must be x1 or x2 and etc?? Can u help me?

And when i have
[
{
"name": "test",
"speedLimit": 0,
"X": [
-284,
-283,
-323,
-324
],
"Y": [
-94,
146,
144,
-99
]
}

4 X and 4 Y how to use them on my InSim with x1 x2 y1 y2 ?
Hey Denis!

I'm glad you decided to keep developing this. Its a great tool.
new version: add load button.
now you can load config from textarea.
Quote from Djem95 :I can't understand how x and y works..

how to use them on my InSim with x1 x2 y1 y2 ?

Read first post or main page in github
How I implement this on my code to detect player location?
ATM I am using like this:

if (((Conn.CompCar.X / 65536) <= -65) && ((Conn.CompCar.X / 65536) >= -116) && ((Conn.CompCar.Y / 65536) <= 219) && ((Conn.CompCar.Y / 65536) >= -46))Conn.Location = Somewhere;

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