Triangle.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Coordinate.h>
namespace geos {
namespace geom { // geos::geom
class GEOS_DLL Triangle {
public:
CoordinateXY p0, p1, p2;
Triangle(const CoordinateXY& nP0, const CoordinateXY& nP1, const CoordinateXY& nP2)
: p0(nP0)
, p1(nP1)
, p2(nP2) {}
void inCentre(CoordinateXY& resultPoint);
static CoordinateXY inCentre(
const CoordinateXY& p0,
const CoordinateXY& p1,
const CoordinateXY& p2);
void circumcentre(CoordinateXY& resultPoint);
void circumcentreDD(CoordinateXY& resultPoint);
static const CoordinateXY circumcentre(const CoordinateXY& p0, const CoordinateXY& p1, const CoordinateXY& p2);
static double circumradius(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c);
double circumradius() const
{
return circumradius(p0, p1, p2);
};
bool isIsoceles();
static bool isAcute(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c);
static bool isCCW(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c);
static bool intersects(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c,
const CoordinateXY& p);
bool intersects(const CoordinateXY& p) { return intersects(p0, p1, p2, p); };
bool isCCW() { return isCCW(p0, p1, p2); };
bool isAcute() { return isAcute(p0, p1, p2); };
static double longestSideLength(
const CoordinateXY& a,
const CoordinateXY& b,
const CoordinateXY& c);
static double length(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c);
double length() const;
static double area(const CoordinateXY& a, const CoordinateXY& b, const CoordinateXY& c);
double area() const;
private:
double det(double m00, double m01, double m10, double m11) const;
};
} // namespace geos::geom
} // namespace geos
geos::geom::Triangle::isCCW
bool isCCW()
Definition Triangle.h:160
geos::geom::Triangle::isAcute
bool isAcute()
Definition Triangle.h:166
geos::geom::Triangle::length
double length() const
geos::geom::Triangle::circumcentre
void circumcentre(CoordinateXY &resultPoint)
Computes the circumcentre of a triangle.
geos::geom::Triangle::isAcute
static bool isAcute(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom::Triangle::circumradius
static double circumradius(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom::Triangle::circumradius
double circumradius() const
Definition Triangle.h:103
geos::geom::Triangle::intersects
static bool intersects(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c, const CoordinateXY &p)
geos::geom::Triangle::circumcentreDD
void circumcentreDD(CoordinateXY &resultPoint)
geos::geom::Triangle::isCCW
static bool isCCW(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom::Triangle::inCentre
void inCentre(CoordinateXY &resultPoint)
The inCentre of a triangle is the point which is equidistant from the sides of the triangle.
geos::geom::Triangle::intersects
bool intersects(const CoordinateXY &p)
Definition Triangle.h:154
geos::geom::Triangle::area
static double area(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom::Triangle::circumcentre
static const CoordinateXY circumcentre(const CoordinateXY &p0, const CoordinateXY &p1, const CoordinateXY &p2)
geos::geom::Triangle::length
static double length(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom::Triangle::longestSideLength
static double longestSideLength(const CoordinateXY &a, const CoordinateXY &b, const CoordinateXY &c)
geos::geom
Definition Angle.h:26
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38