JUCE: Parallelogram< ValueType > Class Template Reference

JUCE

Public Member Functions | Public Attributes | List of all members
Parallelogram< ValueType > Class Template Reference
juce_graphics » geometry

Represents a parallelogram that is defined by 3 points. More...

`#include <juce_Parallelogram.h>`

## Public Member Functions
| Parallelogram ()=default
| Creates a parallelogram with zero size at the origin. More...
| Parallelogram (const Parallelogram &)=default
| Creates a copy of another parallelogram. More...
| Parallelogram (Point< ValueType > topLeftPosition, Point< ValueType > topRightPosition, Point< ValueType > bottomLeftPosition) noexcept
| Creates a parallelogram based on 3 points. More...
| Parallelogram (Rectangle< ValueType > rectangle) noexcept
| Creates a parallelogram from a rectangle. More...
Parallelogram & | operator= (const Parallelogram &)=default
| ~Parallelogram ()=default
| Destructor. More...
bool | isEmpty () const noexcept
| Returns true if the parallelogram has a width or height of more than zero. More...
bool | isFinite () const noexcept
| Returns true if the parallelogram's coordinates are all finite numbers, i.e. More...
ValueType | getWidth () const noexcept
| Returns the width of the parallelogram (i.e. More...
ValueType | getHeight () const noexcept
| Returns the height of the parallelogram (i.e. More...
Point< ValueType > | getTopLeft () const noexcept
| Returns the parallelogram's top-left position as a Point. More...
Point< ValueType > | getTopRight () const noexcept
| Returns the parallelogram's top-right position as a Point. More...
Point< ValueType > | getBottomLeft () const noexcept
| Returns the parallelogram's bottom-left position as a Point. More...
Point< ValueType > | getBottomRight () const noexcept
| Returns the parallelogram's bottom-right position as a Point. More...
bool | operator== (const Parallelogram &other) const noexcept
| Returns true if the two parallelograms are identical. More...
bool | operator!= (const Parallelogram &other) const noexcept
| Returns true if the two parallelograms are not identical. More...
Parallelogram | operator+ (Point< ValueType > deltaPosition) const noexcept
| Returns a parallelogram which is the same as this one moved by a given amount. More...
Parallelogram & | operator+= (Point< ValueType > deltaPosition) noexcept
| Moves this parallelogram by a given amount. More...
Parallelogram | operator- (Point< ValueType > deltaPosition) const noexcept
| Returns a parallelogram which is the same as this one moved by a given amount. More...
Parallelogram & | operator-= (Point< ValueType > deltaPosition) noexcept
| Moves this parallelogram by a given amount. More...
template<typename PointOrScalarType >
Parallelogram | operator* (PointOrScalarType scaleFactor) const noexcept
| Returns a parallelogram that has been scaled by the given amount, centred around the origin. More...
template<typename PointOrScalarType >
Parallelogram | operator*= (PointOrScalarType scaleFactor) noexcept
| Scales this parallelogram by the given amount, centred around the origin. More...
Point< ValueType > | getRelativePoint (Point< ValueType > relativePosition) const noexcept
| Returns a point within this parallelogram, specified as proportional coordinates. More...
Parallelogram | transformedBy (const AffineTransform &transform) const noexcept
| Returns a transformed version of the parallelogram. More...
Rectangle< ValueType > | getBoundingBox () const noexcept
| Returns the smallest rectangle that encloses this parallelogram. More...

## Public Attributes
Point< ValueType > | topLeft
Point< ValueType > | topRight
Point< ValueType > | bottomLeft

## Detailed Description

template<typename ValueType>
class Parallelogram< ValueType >

Represents a parallelogram that is defined by 3 points.

See also
  Rectangle, Point, Line

## Constructor & Destructor Documentation

## ◆ Parallelogram() [1/4]

template<typename ValueType >

Parallelogram< ValueType >::Parallelogram | ( |  | ) |
| default

Creates a parallelogram with zero size at the origin.

## ◆ Parallelogram() [2/4]

template<typename ValueType >

Parallelogram< ValueType >::Parallelogram | ( | const Parallelogram< ValueType > & |  | ) |
| default

Creates a copy of another parallelogram.

## ◆ Parallelogram() [3/4]

template<typename ValueType >

Parallelogram< ValueType >::Parallelogram | ( | Point< ValueType > | topLeftPosition,
|  | Point< ValueType > | topRightPosition,
|  | Point< ValueType > | bottomLeftPosition
| ) |  |
| noexcept

Creates a parallelogram based on 3 points.

## ◆ Parallelogram() [4/4]

template<typename ValueType >

Parallelogram< ValueType >::Parallelogram | ( | Rectangle< ValueType > | rectangle | ) |
| noexcept

Creates a parallelogram from a rectangle.

## ◆ ~Parallelogram()

template<typename ValueType >

Parallelogram< ValueType >::~Parallelogram | ( |  | ) |
| default

Destructor.

## Member Function Documentation

## ◆ operator=()

template<typename ValueType >

Parallelogram & Parallelogram< ValueType >::operator= | ( | const Parallelogram< ValueType > & |  | ) |
| default

## ◆ isEmpty()

template<typename ValueType >

bool Parallelogram< ValueType >::isEmpty | ( |  | ) | const
| noexcept

Returns true if the parallelogram has a width or height of more than zero.

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ isFinite()

template<typename ValueType >

bool Parallelogram< ValueType >::isFinite | ( |  | ) | const
| noexcept

Returns true if the parallelogram's coordinates are all finite numbers, i.e.

not NaN or infinity.

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ getWidth()

template<typename ValueType >

ValueType Parallelogram< ValueType >::getWidth | ( |  | ) | const
| noexcept

Returns the width of the parallelogram (i.e.

the straight-line distance between the top-left and top-right.

References Line< ValueType >::getLength(), Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ getHeight()

template<typename ValueType >

ValueType Parallelogram< ValueType >::getHeight | ( |  | ) | const
| noexcept

Returns the height of the parallelogram (i.e.

the straight-line distance between the top-left and bottom-left.

References Parallelogram< ValueType >::bottomLeft, Line< ValueType >::getLength(), and Parallelogram< ValueType >::topLeft.

## ◆ getTopLeft()

template<typename ValueType >

Point< ValueType > Parallelogram< ValueType >::getTopLeft | ( |  | ) | const
| noexcept

Returns the parallelogram's top-left position as a Point.

References Parallelogram< ValueType >::topLeft.

## ◆ getTopRight()

template<typename ValueType >

Point< ValueType > Parallelogram< ValueType >::getTopRight | ( |  | ) | const
| noexcept

Returns the parallelogram's top-right position as a Point.

References Parallelogram< ValueType >::topRight.

## ◆ getBottomLeft()

template<typename ValueType >

Point< ValueType > Parallelogram< ValueType >::getBottomLeft | ( |  | ) | const
| noexcept

Returns the parallelogram's bottom-left position as a Point.

References Parallelogram< ValueType >::bottomLeft.

## ◆ getBottomRight()

template<typename ValueType >

Point< ValueType > Parallelogram< ValueType >::getBottomRight | ( |  | ) | const
| noexcept

Returns the parallelogram's bottom-right position as a Point.

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

Referenced by Parallelogram< ValueType >::getBoundingBox().

## ◆ operator==()

template<typename ValueType >

bool Parallelogram< ValueType >::operator== | ( | const Parallelogram< ValueType > & | other | ) | const
| noexcept

Returns true if the two parallelograms are identical.

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

Referenced by Parallelogram< ValueType >::operator!=().

## ◆ operator!=()

template<typename ValueType >

bool Parallelogram< ValueType >::operator!= | ( | const Parallelogram< ValueType > & | other | ) | const
| noexcept

Returns true if the two parallelograms are not identical.

References Parallelogram< ValueType >::operator==().

## ◆ operator+()

template<typename ValueType >

Parallelogram Parallelogram< ValueType >::operator+ | ( | Point< ValueType > | deltaPosition | ) | const
| noexcept

Returns a parallelogram which is the same as this one moved by a given amount.

References gl::p.

Referenced by Parallelogram< ValueType >::operator-().

## ◆ operator+=()

template<typename ValueType >

Parallelogram & Parallelogram< ValueType >::operator+= | ( | Point< ValueType > | deltaPosition | ) |
| noexcept

Moves this parallelogram by a given amount.

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ operator-()

template<typename ValueType >

Parallelogram Parallelogram< ValueType >::operator- | ( | Point< ValueType > | deltaPosition | ) | const
| noexcept

Returns a parallelogram which is the same as this one moved by a given amount.

References Parallelogram< ValueType >::operator+().

## ◆ operator-=()

template<typename ValueType >

Parallelogram & Parallelogram< ValueType >::operator-= | ( | Point< ValueType > | deltaPosition | ) |
| noexcept

Moves this parallelogram by a given amount.

References Parallelogram< ValueType >::operator-=().

Referenced by Parallelogram< ValueType >::operator-=().

## ◆ operator*()

template<typename ValueType >
template<typename PointOrScalarType >

Parallelogram Parallelogram< ValueType >::operator* | ( | PointOrScalarType | scaleFactor | ) | const
| noexcept

Returns a parallelogram that has been scaled by the given amount, centred around the origin.

References gl::p, and gl::scaleFactor.

## ◆ operator*=()

template<typename ValueType >
template<typename PointOrScalarType >

Parallelogram Parallelogram< ValueType >::operator*= | ( | PointOrScalarType | scaleFactor | ) |
| noexcept

Scales this parallelogram by the given amount, centred around the origin.

References Parallelogram< ValueType >::bottomLeft, gl::scaleFactor, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ getRelativePoint()

template<typename ValueType >

Point< ValueType > Parallelogram< ValueType >::getRelativePoint | ( | Point< ValueType > | relativePosition | ) | const
| noexcept

Returns a point within this parallelogram, specified as proportional coordinates.

The relative X and Y values should be between 0 and 1, where 0 is the left or top of this parallelogram, and 1 is the right or bottom. (Out-of-bounds values will return a point outside the parallelogram).

References Parallelogram< ValueType >::bottomLeft, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## ◆ transformedBy()

template<typename ValueType >

Parallelogram Parallelogram< ValueType >::transformedBy | ( | const AffineTransform & | transform | ) | const
| noexcept

Returns a transformed version of the parallelogram.

References gl::p, and gl::transform.

## ◆ getBoundingBox()

template<typename ValueType >

Rectangle< ValueType > Parallelogram< ValueType >::getBoundingBox | ( |  | ) | const
| noexcept

Returns the smallest rectangle that encloses this parallelogram.

References Parallelogram< ValueType >::bottomLeft, Rectangle< ValueType >::findAreaContainingPoints(), Parallelogram< ValueType >::getBottomRight(), gl::points, Parallelogram< ValueType >::topLeft, and Parallelogram< ValueType >::topRight.

## Member Data Documentation

## ◆ topLeft

template<typename ValueType >

Point<ValueType> Parallelogram< ValueType >::topLeft

Referenced by Parallelogram< ValueType >::getBottomRight(), Parallelogram< ValueType >::getBoundingBox(), Parallelogram< ValueType >::getHeight(), Parallelogram< ValueType >::getRelativePoint(), Parallelogram< ValueType >::getTopLeft(), Parallelogram< ValueType >::getWidth(), Parallelogram< ValueType >::isEmpty(), Parallelogram< ValueType >::isFinite(), Parallelogram< ValueType >::operator*=(), Parallelogram< ValueType >::operator+=(), and Parallelogram< ValueType >::operator==().

## ◆ topRight

template<typename ValueType >

Point<ValueType> Parallelogram< ValueType >::topRight

Referenced by Parallelogram< ValueType >::getBottomRight(), Parallelogram< ValueType >::getBoundingBox(), Parallelogram< ValueType >::getRelativePoint(), Parallelogram< ValueType >::getTopRight(), Parallelogram< ValueType >::getWidth(), Parallelogram< ValueType >::isEmpty(), Parallelogram< ValueType >::isFinite(), Parallelogram< ValueType >::operator*=(), Parallelogram< ValueType >::operator+=(), and Parallelogram< ValueType >::operator==().

## ◆ bottomLeft

template<typename ValueType >

Point<ValueType> Parallelogram< ValueType >::bottomLeft

Referenced by Parallelogram< ValueType >::getBottomLeft(), Parallelogram< ValueType >::getBottomRight(), Parallelogram< ValueType >::getBoundingBox(), Parallelogram< ValueType >::getHeight(), Parallelogram< ValueType >::getRelativePoint(), Parallelogram< ValueType >::isEmpty(), Parallelogram< ValueType >::isFinite(), Parallelogram< ValueType >::operator*=(), Parallelogram< ValueType >::operator+=(), and Parallelogram< ValueType >::operator==().

The documentation for this class was generated from the following file:

- juce_Parallelogram.h