num factor
) Scale this point by factor
as if it were a vector.
Important Note: This function accepts a num
as its argument only so
that you can scale Point<double> objects by an int
factor. Because the
star operator always returns the same type of Point that originally called
it, passing in a double factor
on a Point<int>
causes a
runtime error in checked mode.
Source
/**
* Scale this point by [factor] as if it were a vector.
*
* *Important* *Note*: This function accepts a `num` as its argument only so
* that you can scale Point<double> objects by an `int` factor. Because the
* star operator always returns the same type of Point that originally called
* it, passing in a double [factor] on a `Point<int>` _causes_ _a_
* _runtime_ _error_ in checked mode.
*/
Point<T> operator *(num factor) {
return new Point<T>(x * factor, y * factor);
}