RTriangle
Class in Math Module
Header: #include <src/core/math/RTriangle.h>
Inherits: RShape, RExplodable
Description
Section titled “Description”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.
Public Functions
Section titled “Public Functions”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 ¢er=RDEFAULT_RVECTOR) |
| virtual bool | scale(const RVector &scaleFactors, const RVector ¢er=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 Public Functions
Section titled “Static Public Functions”| static RTriangle | createArrow(const RVector &position, double direction, double size) |
Public Attributes
Section titled “Public Attributes”| RVector | corner |
Protected Functions
Section titled “Protected Functions”| virtual void | print(QDebug dbg) const |
Member Documentation
Section titled “Member Documentation”RTriangle
Section titled “RTriangle”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
Section titled “RTriangle”RTriangle::RTriangle(const RVector &p1, const RVector &p2, const RVector &p3)Creates a triangle with the given corners.
~RTriangle
Section titled “~RTriangle”virtual RTriangle::~RTriangle()virtual
virtual QSharedPointer< RShape > RTriangle::clone() constvirtual inline const
Reimplemented from clone.
cloneToTriangle
Section titled “cloneToTriangle”QSharedPointer< RTriangle > RTriangle::cloneToTriangle() constinline const
flipHorizontal
Section titled “flipHorizontal”virtual bool RTriangle::flipHorizontal()virtual inline
Reimplemented from flipHorizontal.
flipVertical
Section titled “flipVertical”virtual bool RTriangle::flipVertical()virtual inline
Reimplemented from flipVertical.
getArea
Section titled “getArea”double RTriangle::getArea() constconst
getBoundingBox
Section titled “getBoundingBox”virtual RBox RTriangle::getBoundingBox() constvirtual const
Returns: The bounding box of this shape.
Reimplemented from getBoundingBox.
getCenterPoints
Section titled “getCenterPoints”virtual QList< RVector > RTriangle::getCenterPoints() constvirtual const
Returns: The center point(s) of this shape.
Reimplemented from getCenterPoints.
getCorner
Section titled “getCorner”RVector RTriangle::getCorner(int i) constconst
double RTriangle::getD() constconst
Returns: ‘d’ in the plane equation ‘ax + by + cz = d’.
getDistanceTo
Section titled “getDistanceTo”virtual double RTriangle::getDistanceTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) constvirtual const
Returns: Shortest distance from this shape to the given point. Based on getVectorTo.
Reimplemented from getDistanceTo.
getEndPoints
Section titled “getEndPoints”virtual QList< RVector > RTriangle::getEndPoints() constvirtual const
Returns: The end point(s) of this shape.
Reimplemented from getEndPoints.
getExploded
Section titled “getExploded”virtual QList< QSharedPointer< RShape > > RTriangle::getExploded(int segments=RDEFAULT_MIN1) constvirtual const
Returns: List of RLines describing this triangle.
Reimplemented from getExploded.
getLength
Section titled “getLength”virtual double RTriangle::getLength() constvirtual const
Returns: The total length of this shape if applicable or NaN if not.
Reimplemented from getLength.
getMiddlePoints
Section titled “getMiddlePoints”virtual QList< RVector > RTriangle::getMiddlePoints() constvirtual const
Returns: The middle point(s) of this shape.
Reimplemented from getMiddlePoints.
getNormal
Section titled “getNormal”virtual RVector RTriangle::getNormal() constvirtual 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.
getOrientation
Section titled “getOrientation”RS::Orientation RTriangle::getOrientation() constconst
getPointCloud
Section titled “getPointCloud”virtual QList< RVector > RTriangle::getPointCloud(double segmentLength) constvirtual const
Reimplemented from getPointCloud.
getPointsWithDistanceToEnd
Section titled “getPointsWithDistanceToEnd”virtual QList< RVector > RTriangle::getPointsWithDistanceToEnd(double distance, int from=RS::FromAny) constvirtual const
Returns: All points on this shape with the given distance to an endpoint.
Reimplemented from getPointsWithDistanceToEnd.
getPolyline
Section titled “getPolyline”RPolyline RTriangle::getPolyline() constconst
getShapeType
Section titled “getShapeType”virtual RShape::Type RTriangle::getShapeType() constvirtual inline const
Reimplemented from getShapeType.
getTransformed
Section titled “getTransformed”virtual QSharedPointer< RShape > RTriangle::getTransformed(const QTransform &transform) constvirtual inline const
Reimplemented from getTransformed.
getVectorProperties
Section titled “getVectorProperties”virtual QList< RVector > RTriangle::getVectorProperties() constvirtual const
Reimplemented from getVectorProperties.
getVectorTo
Section titled “getVectorTo”virtual RVector RTriangle::getVectorTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) constvirtual const
Returns: Shortest vector from this shape to the given point.
Parameters:
point: the given pointlimited: 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.
isPointInQuadrant
Section titled “isPointInQuadrant”bool RTriangle::isPointInQuadrant(const RVector &p) constconst
isPointInTriangle
Section titled “isPointInTriangle”bool RTriangle::isPointInTriangle(const RVector &p, bool treatAsQuadrant=false) constconst
Returns: True if the given point is inside this triangle.
Parameters:
ip: the pointtreatAsQuadrant: IftreatAsQuadrantis 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].
mirror
Section titled “mirror”virtual bool RTriangle::mirror(const RLine &axis)virtual inline
Reimplemented from mirror.
virtual bool RTriangle::move(const RVector &offset)virtual inline
Reimplemented from move.
reverse
Section titled “reverse”virtual bool RTriangle::reverse()virtual
Reimplemented from reverse.
rotate
Section titled “rotate”virtual bool RTriangle::rotate(double rotation, const RVector ¢er=RDEFAULT_RVECTOR)virtual inline
Reimplemented from rotate.
virtual bool RTriangle::scale(const RVector &scaleFactors, const RVector ¢er=RDEFAULT_RVECTOR)virtual inline
Reimplemented from scale.
setCorner
Section titled “setCorner”void RTriangle::setCorner(int i, const RVector &p)setCorners
Section titled “setCorners”void RTriangle::setCorners(const RVector &c1, const RVector &c2, const RVector &c3)virtual void RTriangle::setZ(double z)virtual
Reimplemented from setZ.
createArrow
Section titled “createArrow”static RTriangle RTriangle::createArrow(const RVector &position, double direction, double size)static
corner
Section titled “corner”RVector RTriangle::corner[3] [3]virtual void RTriangle::print(QDebug dbg) constvirtual const protected
Reimplemented from print.