Commit eb22bf42 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: very minor fixes and update: update clipper version. uncrustify...

Pcbnew: very minor fixes and update:  update clipper version. uncrustify polytri/* and fix some warning compil.
parent 6e56aa2f
......@@ -13,7 +13,7 @@
#ifndef DRW_BASE_H
#define DRW_BASE_H
#define DRW_VERSION "0.5.10"
#define DRW_VERSION "0.5.11"
#include <string>
#include <cmath>
......
......@@ -27,7 +27,7 @@ class dxfRW
public:
dxfRW( const char* name );
~dxfRW();
// / reads the file specified in constructor
/// reads the file specified in constructor
/*!
* An interface must be provided. It is used by the class to signal various
* components being added.
......@@ -71,7 +71,7 @@ public:
void setEllipseParts( int parts ) { elParts = parts; } /*!< set parts munber when convert ellipse to polyline */
private:
// / used by read() to parse the content of the file
/// used by read() to parse the content of the file
bool processDxf();
bool processHeader();
bool processTables();
......
......@@ -88,8 +88,8 @@ CPolyLine::~CPolyLine()
#include "clipper.hpp"
int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
{
ClipperLib::Polygon raw_polygon;
ClipperLib::Polygons normalized_polygons;
ClipperLib::Path raw_polygon;
ClipperLib::Paths normalized_polygons;
unsigned corners_count = m_CornersList.GetCornersCount();
......@@ -115,7 +115,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
// enter main outline
for( unsigned ii = 0; ii < normalized_polygons.size(); ii++ )
{
ClipperLib::Polygon& polygon = normalized_polygons[ii];
ClipperLib::Path& polygon = normalized_polygons[ii];
cornerslist.clear();
for( unsigned jj = 0; jj < polygon.size(); jj++ )
cornerslist.push_back( KI_POLY_POINT( KiROUND( polygon[jj].X ),
......@@ -142,7 +142,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
ClipperLib::SimplifyPolygon( raw_polygon, normalized_polygons );
for( unsigned ii = 0; ii < normalized_polygons.size(); ii++ )
{
ClipperLib::Polygon& polygon = normalized_polygons[ii];
ClipperLib::Path& polygon = normalized_polygons[ii];
cornerslist.clear();
for( unsigned jj = 0; jj < polygon.size(); jj++ )
cornerslist.push_back( KI_POLY_POINT( KiROUND( polygon[jj].X ),
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
/*
* Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
* http://code.google.com/p/poly2tri/
*
......@@ -28,7 +28,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UTILS_H
#define UTILS_H
......@@ -39,12 +39,13 @@
#include <math.h>
namespace p2t {
const double PI_3div4 = 3 * M_PI / 4;
const double PI_div2 = 1.57079632679489661923;
const double EPSILON = 1e-12;
const double PI_3div4 = 3 * M_PI / 4;
const double PI_div2 = 1.57079632679489661923;
const double EPSILON = 1e-12;
enum Orientation { CW, CCW, COLLINEAR };
enum Orientation {
CW, CCW, COLLINEAR
};
/**
* Forumla to calculate signed area<br>
......@@ -56,68 +57,77 @@ enum Orientation { CW, CCW, COLLINEAR };
* = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
* </pre>
*/
Orientation Orient2d(Point& pa, Point& pb, Point& pc)
Orientation Orient2d( Point& pa, Point& pb, Point& pc )
{
double detleft = (pa.x - pc.x) * (pb.y - pc.y);
double detright = (pa.y - pc.y) * (pb.x - pc.x);
double val = detleft - detright;
if (val > -EPSILON && val < EPSILON) {
return COLLINEAR;
} else if (val > 0) {
return CCW;
}
return CW;
double detleft = (pa.x - pc.x) * (pb.y - pc.y);
double detright = (pa.y - pc.y) * (pb.x - pc.x);
double val = detleft - detright;
if( val > -EPSILON && val < EPSILON )
{
return COLLINEAR;
}
else if( val > 0 )
{
return CCW;
}
return CW;
}
/*
bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
{
double pdx = pd.x;
double pdy = pd.y;
double adx = pa.x - pdx;
double ady = pa.y - pdy;
double bdx = pb.x - pdx;
double bdy = pb.y - pdy;
double adxbdy = adx * bdy;
double bdxady = bdx * ady;
double oabd = adxbdy - bdxady;
if (oabd <= EPSILON) {
return false;
}
double cdx = pc.x - pdx;
double cdy = pc.y - pdy;
/*
* bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
* {
* double pdx = pd.x;
* double pdy = pd.y;
* double adx = pa.x - pdx;
* double ady = pa.y - pdy;
* double bdx = pb.x - pdx;
* double bdy = pb.y - pdy;
*
* double adxbdy = adx * bdy;
* double bdxady = bdx * ady;
* double oabd = adxbdy - bdxady;
*
* if (oabd <= EPSILON) {
* return false;
* }
*
* double cdx = pc.x - pdx;
* double cdy = pc.y - pdy;
*
* double cdxady = cdx * ady;
* double adxcdy = adx * cdy;
* double ocad = cdxady - adxcdy;
*
* if (ocad <= EPSILON) {
* return false;
* }
*
* return true;
* }
*
*/
double cdxady = cdx * ady;
double adxcdy = adx * cdy;
double ocad = cdxady - adxcdy;
bool InScanArea( Point& pa, Point& pb, Point& pc, Point& pd )
{
double oadb = (pa.x - pb.x) * (pd.y - pb.y) - (pd.x - pb.x) * (pa.y - pb.y);
if (ocad <= EPSILON) {
return false;
}
if( oadb >= -EPSILON )
{
return false;
}
return true;
}
double oadc = (pa.x - pc.x) * (pd.y - pc.y) - (pd.x - pc.x) * (pa.y - pc.y);
*/
if( oadc <= EPSILON )
{
return false;
}
bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
{
double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y);
if (oadb >= -EPSILON) {
return false;
}
double oadc = (pa.x - pc.x)*(pd.y - pc.y) - (pd.x - pc.x)*(pa.y - pc.y);
if (oadc <= EPSILON) {
return false;
}
return true;
return true;
}
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment