This class is an extension (but not a subclass of) `point()`

. It simply
attaches a numeric weight to the point that is carried along with it.
However, most of the functionality of points are lost with this vector class
as all the a math and sorting operations are gone due to ambiguity on whether
to operate on the point or the weight. Weighted points can easily be
converted to points however.

weighted_point(..., default_dim = 2) is_weighted_point(x) as_weighted_point(x)

... | Various input. See the Constructor section. |
---|---|

default_dim | The dimensionality when constructing an empty vector |

x | A point vector or an object to convert to it |

a `euclid_point_w`

vector

**2 dimensional weighted points**

Providing three numeric vector will construct points with those x and y coordinate and a weight.

Providing a point and a numeric will construct points with the given weight

**3 dimensional weighted points**

Providing four numeric vector will construct points with those x, y and z coordinate and a weight.

Providing a point and a numeric will construct points with the given weight

#> <2D point_ws [5]> #> [1] <x:4, y:1, w:0.346> <x:3, y:2, w:0.0673> <x:2, y:3, w:0.027> #> [4] <x:1, y:5, w:0.118> <x:5, y:4, w:0.0137>#> <2D points [5]> #> [1] <x:4, y:1> <x:3, y:2> <x:2, y:3> <x:1, y:5> <x:5, y:4># Construct from point and weight weighted_point(p, 1:5)#> <2D point_ws [5]> #> [1] <x:4, y:1, w:1> <x:3, y:2, w:2> <x:2, y:3, w:3> <x:1, y:5, w:4> #> [5] <x:5, y:4, w:5>