Skip to content

RTriangle

Class in Math Module
Header: #include <src/core/math/RTriangle.h>
Inherits: RShape, RExplodable

Low-level mathematical representation of a triangle.

Scriptable: This class is available in script environments.

Shared Pointer Support: Objects can be used in QSharedPointer.

Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.

Stream Operator: Object has a stream operator to present itself as string, for example when using toString() in a script.

RTriangle()
RTriangle(const RVector &p1, const RVector &p2, const RVector &p3)
Creates a triangle with the given corners.
virtual ~RTriangle()
virtual QSharedPointer< RShape > clone() const
QSharedPointer< RTriangle > cloneToTriangle() const
virtual bool flipHorizontal()
virtual bool flipVertical()
double getArea() const
virtual RBox getBoundingBox() const
virtual QList< RVector > getCenterPoints() const
RVector getCorner(int i) const
double getD() const
virtual double getDistanceTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
virtual QList< RVector > getEndPoints() const
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
virtual double getLength() const
virtual QList< RVector > getMiddlePoints() const
virtual RVector getNormal() const
RS::Orientation getOrientation() const
virtual QList< RVector > getPointCloud(double segmentLength) const
virtual QList< RVector > getPointsWithDistanceToEnd(double distance, int from=RS::FromAny) const
RPolyline getPolyline() const
virtual RShape::Type getShapeType() const
virtual QSharedPointer< RShape > getTransformed(const QTransform &transform) const
virtual QList< RVector > getVectorProperties() const
virtual RVector getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
bool isPointInQuadrant(const RVector &p) const
bool isPointInTriangle(const RVector &p, bool treatAsQuadrant=false) const
virtual bool mirror(const RLine &axis)
virtual bool move(const RVector &offset)
virtual bool reverse()
virtual bool rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
void setCorner(int i, const RVector &p)
void setCorners(const RVector &c1, const RVector &c2, const RVector &c3)
virtual void setZ(double z)
static RTriangle createArrow(const RVector &position, double direction, double size)
RVector corner
virtual void print(QDebug dbg) const

RTriangle::RTriangle()

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD. Creates a triangle with invalid corner points.

RTriangle::RTriangle(const RVector &p1, const RVector &p2, const RVector &p3)

Creates a triangle with the given corners.

virtual RTriangle::~RTriangle()

virtual

virtual QSharedPointer< RShape > RTriangle::clone() const

virtual inline const

Reimplemented from clone.

QSharedPointer< RTriangle > RTriangle::cloneToTriangle() const

inline const

virtual bool RTriangle::flipHorizontal()

virtual inline

Reimplemented from flipHorizontal.

virtual bool RTriangle::flipVertical()

virtual inline

Reimplemented from flipVertical.

double RTriangle::getArea() const

const

virtual RBox RTriangle::getBoundingBox() const

virtual const

Returns: The bounding box of this shape.

Reimplemented from getBoundingBox.

virtual QList< RVector > RTriangle::getCenterPoints() const

virtual const

Returns: The center point(s) of this shape.

Reimplemented from getCenterPoints.

RVector RTriangle::getCorner(int i) const

const

double RTriangle::getD() const

const

Returns: ‘d’ in the plane equation ‘ax + by + cz = d’.

virtual double RTriangle::getDistanceTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const

virtual const

Returns: Shortest distance from this shape to the given point. Based on getVectorTo.

Reimplemented from getDistanceTo.

virtual QList< RVector > RTriangle::getEndPoints() const

virtual const

Returns: The end point(s) of this shape.

Reimplemented from getEndPoints.

virtual QList< QSharedPointer< RShape > > RTriangle::getExploded(int segments=RDEFAULT_MIN1) const

virtual const

Returns: List of RLines describing this triangle.

Reimplemented from getExploded.

virtual double RTriangle::getLength() const

virtual const

Returns: The total length of this shape if applicable or NaN if not.

Reimplemented from getLength.

virtual QList< RVector > RTriangle::getMiddlePoints() const

virtual const

Returns: The middle point(s) of this shape.

Reimplemented from getMiddlePoints.

virtual RVector RTriangle::getNormal() const

virtual const

See also: http://en.wikipedia.org/wiki/Normal_vector

See also: http://en.wikipedia.org/wiki/Cross_product#Definition

Returns: The normal vector of this triangle. The length of the normal vector equals double the area of the triangle.

RS::Orientation RTriangle::getOrientation() const

const

virtual QList< RVector > RTriangle::getPointCloud(double segmentLength) const

virtual const

Reimplemented from getPointCloud.

virtual QList< RVector > RTriangle::getPointsWithDistanceToEnd(double distance, int from=RS::FromAny) const

virtual const

Returns: All points on this shape with the given distance to an endpoint.

Reimplemented from getPointsWithDistanceToEnd.

RPolyline RTriangle::getPolyline() const

const

virtual RShape::Type RTriangle::getShapeType() const

virtual inline const

Reimplemented from getShapeType.

virtual QSharedPointer< RShape > RTriangle::getTransformed(const QTransform &transform) const

virtual inline const

Reimplemented from getTransformed.

virtual QList< RVector > RTriangle::getVectorProperties() const

virtual const

Reimplemented from getVectorProperties.

virtual RVector RTriangle::getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const

virtual const

Returns: Shortest vector from this shape to the given point.

Parameters:

  • point: the given point
  • limited: If false, the shape is treated as an unlimited shape that extends in a logical way. For example an unlimited line for a line, full circle for an arc or a plane for a triangle.

Reimplemented from getVectorTo.

bool RTriangle::isPointInQuadrant(const RVector &p) const

const

bool RTriangle::isPointInTriangle(const RVector &p, bool treatAsQuadrant=false) const

const

Returns: True if the given point is inside this triangle.

Parameters:

  • ip: the point
  • treatAsQuadrant: If treatAsQuadrant is true, the triangle is treated as an open quadrant or segment with its center at the first corner. In this case, the point is inside, if it is on the plane that is limited by the two rays corner[0] -> corner[1] and corner[0] -> corner[2].

virtual bool RTriangle::mirror(const RLine &axis)

virtual inline

Reimplemented from mirror.

virtual bool RTriangle::move(const RVector &offset)

virtual inline

Reimplemented from move.

virtual bool RTriangle::reverse()

virtual

Reimplemented from reverse.

virtual bool RTriangle::rotate(double rotation, const RVector &center=RDEFAULT_RVECTOR)

virtual inline

Reimplemented from rotate.

virtual bool RTriangle::scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)

virtual inline

Reimplemented from scale.

void RTriangle::setCorner(int i, const RVector &p)

void RTriangle::setCorners(const RVector &c1, const RVector &c2, const RVector &c3)

virtual void RTriangle::setZ(double z)

virtual

Reimplemented from setZ.

static RTriangle RTriangle::createArrow(const RVector &position, double direction, double size)

static

RVector RTriangle::corner[3] [3]

virtual void RTriangle::print(QDebug dbg) const

virtual const protected

Reimplemented from print.