GPoint class
The GPoint object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.
The following code creates a point at (0,0):
final myPoint = GPoint();
- Available Extensions
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → double
-
The length of a line segment from (0,0) to this point.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- x ↔ double
-
The horizontal coordinate of the point.
getter/setter pair
- y ↔ double
-
The vertical coordinate of the point.
getter/setter pair
Methods
-
add(
GPoint point) → GPoint -
Adds the coordinates of another
point
to the coordinates of this point and returns the result as a new point. -
clone(
) → GPoint - Creates a copy of this GPoint object.
-
equals(
GPoint point) → bool - Checks if this GPoint is equal to another GPoint by comparing their x and y coordinates. Returns true if they are equal, otherwise false.
-
multiply(
[double dx = 1, double dy = 1]) → void - Multiply the coordinates of this GPoint by given dx and dy values.
-
normalize(
double thickness) → void -
=== Mutators ===
The following methods modify the current point.
Normalizes the GPoint to have the specified
thickness
but keeping its direction. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offset(
double dx, double dy) → void -
Offsets this point's coordinates by
dx
along the x-axis and bydy
along the y-axis. -
setEmpty(
) → GPoint -
Sets the
x
andy
values of this point to zero. -
setTo(
double x, double y) → GPoint -
Sets the x and y values of this GPoint to the provided
x
andy
values respectively. -
subtract(
GPoint point) → GPoint - Subtracts the coordinates of another point from the coordinates of this point to create a new point.
-
toNative(
) → Offset - Creates a Dart Offset instance from this GPoint.
-
toString(
) → String -
Returns a string that contains the values of the x and y coordinates.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
distance(
GPoint p1, GPoint p2) → double -
Returns the distance between
p1
andp2
. -
fromNative(
Offset nativeOffset) → GPoint - Creates a point instance from an dart Offset.
-
interpolate(
GPoint a, GPoint b, double f) → GPoint -
Returns the point that is at the position specified by the interpolation
factor
f
between pointsa
andb
. -
polar(
double length, double angle) → GPoint - Returns a new GPoint object in polar coordinates based on a length and an angle.