SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Helper_ConvexHull.h
Go to the documentation of this file.
1
/****************************************************************************/
8
//
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11
// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef Helper_ConvexHull_h
22
#define Helper_ConvexHull_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
29
30
#ifdef _MSC_VER
31
#include <
windows_config.h
>
32
#else
33
#include <
config.h
>
34
#endif
35
36
#include "
Position.h
"
37
#include "
PositionVector.h
"
38
#include <vector>
39
40
// Copyright 2002, softSurfer (www.softsurfer.com)
41
// This code may be freely used and modified for any purpose
42
// providing that this copyright notice is included with it.
43
// SoftSurfer makes no warranty for this code, and cannot be held
44
// liable for any real or imagined damage resulting from its use.
45
// Users of this code must verify correctness for their application.
46
47
48
// Assume that a class is already given for the object:
49
// Position with coordinates {SUMOReal x, y;}
50
//===================================================================
51
52
53
// isLeft(): test if a Position is Left|On|Right of an infinite line.
54
// Input: three Positions P0, P1, and P2
55
// Return: >0 for P2 left of the line through P0 and P1
56
// =0 for P2 on the line
57
// <0 for P2 right of the line
58
// See: the January 2001 Algorithm on Area of Triangles
59
60
61
inline
SUMOReal
62
isLeft
(
const
Position
& P0,
63
const
Position
& P1,
64
const
Position
& P2) {
65
return
(P1.
x
() - P0.
x
()) * (P2.
y
() - P0.
y
()) - (P2.
x
() - P0.
x
()) * (P1.
y
() - P0.
y
());
66
}
67
68
69
PositionVector
70
simpleHull_2D
(
const
PositionVector
& V);
71
72
73
#endif
74
75
/****************************************************************************/
76
isLeft
SUMOReal isLeft(const Position &P0, const Position &P1, const Position &P2)
Definition:
Helper_ConvexHull.h:62
windows_config.h
config.h
Position::x
SUMOReal x() const
Returns the x-position.
Definition:
Position.h:63
Position
A point in 2D or 3D with translation and scaling methods.
Definition:
Position.h:46
PositionVector.h
PositionVector
A list of positions.
Definition:
PositionVector.h:52
Position.h
Position::y
SUMOReal y() const
Returns the y-position.
Definition:
Position.h:68
SUMOReal
#define SUMOReal
Definition:
config.h:214
simpleHull_2D
PositionVector simpleHull_2D(const PositionVector &V)
Definition:
Helper_ConvexHull.cpp:51
src
utils
geom
Helper_ConvexHull.h
Generated on Sun Mar 19 2017 15:07:36 for SUMO - Simulation of Urban MObility by
1.8.8