Rectangular shape.
This class is used to define any arbitrary rectangular shape. Note that this class only describes the rectangular shape but does not hold any content.
Value parameters
- height
-
Height of the rectangular.
- width
-
Width of the rectangular.
- x
-
X-coordinate of the left top corner.
- y
-
Y-coordinate of the left top corner.
Attributes
- See also
-
CPArray2D 2D content holder.
- Companion
- object
- Source
- CPRect.scala
- Graph
-
- Supertypes
Members list
Value members
Constructors
Creates rectangle from two tuples.
Creates rectangle from two tuples.
Value parameters
- p1
-
XY-coordinate of the top left corner.
- p2
-
XY-coordinate of the bottom right corner.
Attributes
- Source
- CPRect.scala
Creates rectangle from two tuples.
Creates rectangle from two tuples.
Value parameters
- p1
-
XY-coordinate of the top left corner.
- p2
-
XY-coordinate of the bottom right corner.
Attributes
- Source
- CPRect.scala
Creates rectangle.
Creates rectangle.
Value parameters
- dim
-
Dimension of the rectangle.
- x
-
X-coordinate of the top left corner.
- y
-
Y-coordinate of the top left corner.
Attributes
- Source
- CPRect.scala
Creates rectangle with (0,0)
left top corner and given dimension.
Creates rectangle with (0,0)
left top corner and given dimension.
Value parameters
- dim
-
Rectangle dimension.
Attributes
- Source
- CPRect.scala
Concrete methods
Whether or not given point is contained within this rectangle. This includes a point on the edge of the rectangle.
Whether or not given point is contained within this rectangle. This includes a point on the edge of the rectangle.
Value parameters
- a
-
X coordinate.
- b
-
Y coordinate.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle contains given rectangle.
Tests whether this rectangle contains given rectangle.
Value parameters
- rect
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle contains given rectangle horizontally.
Tests whether this rectangle contains given rectangle horizontally.
Value parameters
- rect
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle contains given rectangle vertically.
Tests whether this rectangle contains given rectangle vertically.
Value parameters
- rect
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
x
of typeAny
,x.equals(x)
should returntrue
. - It is symmetric: for any instances
x
andy
of typeAny
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any instances
x
,y
, andz
of typeAny
ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
true
if the receiver object is equivalent to the argument;false
otherwise. - Definition Classes
-
Equals -> CPIntTuple -> Any
- Source
- CPRect.scala
Tests whether this rectangle has at least one points satisfying given predicate.
Tests whether this rectangle has at least one points satisfying given predicate.
Value parameters
- f
-
Predicate to test.
Attributes
- Source
- CPRect.scala
Creates new rectangle grown in size enough to contain a given point. This method always creates new rectangle and its dimension will always be equal or larger than the dimension of this rectangle.
Creates new rectangle grown in size enough to contain a given point. This method always creates new rectangle and its dimension will always be equal or larger than the dimension of this rectangle.
Value parameters
- x2
-
X-coordinate of the point.
- y2
-
Y-coordinate of the point.
Attributes
- Source
- CPRect.scala
Creates intersection rectangle between this rectangle and a given one. If rectangles don't intersect, CPRect.ZERO is returned.
Creates intersection rectangle between this rectangle and a given one. If rectangles don't intersect, CPRect.ZERO is returned.
Value parameters
- rect
-
Rectangle to intersect with.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle is position above of the given rectangle.
Tests whether this rectangle is position above of the given rectangle.
Value parameters
- r
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle is position below of the given rectangle.
Tests whether this rectangle is position below of the given rectangle.
Value parameters
- r
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle is position to the left of the given rectangle.
Tests whether this rectangle is position to the left of the given rectangle.
Value parameters
- r
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Tests whether this rectangle is position to the right of the given rectangle.
Tests whether this rectangle is position to the right of the given rectangle.
Value parameters
- r
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
Value parameters
- f
-
XY-coordinate function to call.
Attributes
- See also
- Source
- CPRect.scala
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
Value parameters
- f
-
XY-coordinate function to call.
Attributes
- See also
- Source
- CPRect.scala
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be vertical first. In other words, given the rectangle with the following coordinates:
Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be vertical first. In other words, given the rectangle with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2)
Value parameters
- f
-
XY-coordinate function to call.
Attributes
- See also
- Source
- CPRect.scala
Tests whether or not this rectangle overlaps with the given one. Note that "touching" rectangles do not intersect as far as this method is concerned.
Tests whether or not this rectangle overlaps with the given one. Note that "touching" rectangles do not intersect as far as this method is concerned.
Value parameters
- rect
-
Rectangle to test.
Attributes
- Source
- CPRect.scala
Gets random X-coordinate within this rectangle.
Gets random XY-coordinate within this rectangle.
Gets random Y-coordinate within this rectangle.
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
CPIntTuple -> Any
- Source
- CPRect.scala
Creates new rectangle with a minimal size to contain both this and given rectangle.
Creates new rectangle with a minimal size to contain both this and given rectangle.
Value parameters
- rect
-
Rectangle to combine with this rectangle.
Attributes
- Source
- CPRect.scala
Inherited methods
Multiplies given value with each member of this tuple.
Multiplies given value with each member of this tuple.
Value parameters
- x
-
Value to multiple by.
Attributes
- Returns
-
New tuple as a result of multiplication.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Multiple two tuples by multiplying their corresponding values.
Multiple two tuples by multiplying their corresponding values.
Value parameters
- x
-
Other tuple to multiply with.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Adds given value to each member of this tuple.
Adds given value to each member of this tuple.
Value parameters
- x
-
Value to add.
Attributes
- Returns
-
New tuple as a result of addition.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Adds two tuples by adding their corresponding values.
Adds two tuples by adding their corresponding values.
Value parameters
- x
-
Tuple to add.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Subtracts given value from each member of this tuple.
Subtracts given value from each member of this tuple.
Value parameters
- x
-
Value to subtract.
Attributes
- Returns
-
New tuple as a result of subtraction.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Subtracts given tuple from this one by subtracting their corresponding values.
Subtracts given tuple from this one by subtracting their corresponding values.
Value parameters
- x
-
Tuple to subtract.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Divides each member of this tuple by the given value.
Divides each member of this tuple by the given value.
Value parameters
- x
-
Value to divide by.
Attributes
- Returns
-
New tuple as a result of division.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Device this tuple by the given tuple by dividing their corresponding values.
Device this tuple by the given tuple by dividing their corresponding values.
Value parameters
- x
-
Other tuple to divide by.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Less-then '<' operator for int
.
Less-then '<' operator for int
.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Less-then '<' operator for tuples.
Less-then '<' operator for tuples.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Less-then-or-equal '<=' operator for tuples.
Less-then-or-equal '<=' operator for tuples.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Less-then-or-equal '<=' operator for int
.
Less-then-or-equal '<=' operator for int
.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Greater-then '>' operator for tuples.
Greater-then '>' operator for tuples.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Greater-then '>' operator for int
.
Greater-then '>' operator for int
.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Greater-then-or-equal '>=' operator for tuples.
Greater-then-or-equal '>=' operator for tuples.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Greater-then-or-equal '>=' operator for int
.
Greater-then-or-equal '>=' operator for int
.
Value parameters
- x
-
Other tuple to compare.
Attributes
- Note
-
Tuples must have the same arity.
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Attributes
- Definition Classes
-
CPInt4 -> Ordered
- Inherited from:
- CPInt4
- Source
- CPInt4.scala
Creates a copy of this tuple.
Creates a copy of this tuple.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Tests whether all values in this tuple are one.
Tests whether all values in this tuple are one.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Checks if this tuple contains only positive (> 0) numbers.
Checks if this tuple contains only positive (> 0) numbers.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Checks if this tuple contains only whole (>= 0) numbers.
Checks if this tuple contains only whole (>= 0) numbers.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Tests whether all values in this tuple are zero.
Tests whether all values in this tuple are zero.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Maps this tuple using given function.
Maps this tuple using given function.
Value parameters
- f
-
Mapping function.
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Concrete fields
Area of this rectangle as width * height
.
X-coordinate of the center point.
X-coordinate of the center point as a float.
Y-coordinate of the center point.
Y-coordinate of the center point as a float.
Dimension of this rectangle.
Height of the rectangular (shortcut API).
Height of the rectangular (shortcut API) as a float.
Whether width or height equals to zero.
Whether width and height are greater than zero.
Width of the rectangular (shortcut API).
Width of the rectangular (shortcut API) as a float.
Maximum X-coordinate. If width is zero this will equal to x - 1
.
Maximum X-coordinate as a float. If width is zero this will equal to x - 1
.
Maximum X-coordinate as a float. If width is zero this will equal to x - 1
.
Attributes
- Source
- CPRect.scala
Minimal X-coordinate. It is equal to x
.
Minimal X-coordinate as a float. It is equal to x
.
Maximum Y-coordinate. If height is zero this will equal to y - 1
.
Maximum Y-coordinate as a float. If height is zero this will equal to y - 1
.
Maximum Y-coordinate as a float. If height is zero this will equal to y - 1
.
Attributes
- Source
- CPRect.scala
Minimal Y-coordinate. It is equal to y
.
Minimal Y-coordinate as a float. It is equal to y
.
Inherited fields
Arity of this tuple.
Attributes
- Inherited from:
- CPInt4
- Source
- CPInt4.scala
Attributes
- Inherited from:
- CPInt4
- Source
- CPInt4.scala
Attributes
- Inherited from:
- CPInt4
- Source
- CPInt4.scala
Attributes
- Inherited from:
- CPInt4
- Source
- CPInt4.scala
Attributes
- Inherited from:
- CPIntTuple (hidden)
- Source
- CPIntTuple.scala