Const
Sets the x and y values of a PointType instance. The first parameter can be any object containing 'x' and 'y' properties, or a numeric value for the 'x' value. In the latter case, if a 2nd parameter is passed, it is assigned to the 'y' value; otherwise the first parameter is used for both 'x' and 'y'.
Returns true if both x and y values of pt
are within epsilon
delta of zero.
Point
is a static/const container for helper functions to deal with PointType objects, such as creating them or doing math operations. Benchmarks show 40x(!) faster performance when creating plain objects vs. classes/function prototypes, although once any members are accessed, the difference drops to "only" 2-3 improvement. The performance difference of using instance methods vs. static functions (like provided here) is less significant. So in some cases the convenience may outweigh the creation cost. Generally, read-only access if faster on plain objects vs. class instances, while changing property values is faster on the latter.Point
could be converted to a class with static methods, which in some cases seems to perform (a little) better or (much) worse depending on the operation and what is being operated on (plain object or Vect2d class instance), and perhaps other factors.