-
Notifications
You must be signed in to change notification settings - Fork 25
cls_Point
Almar Klein edited this page Jun 1, 2017
·
4 revisions
Inherits from BasePoints.
Represents a point or vector (of any dimension).
This class implements many usefull operators such as addition and multiplication, and provides common mathematical operations that can be applied to points and pointsets.
Example
p1 = Point(3.2,4) # a 2D point
p2 = p1.copy() # make a copy
p1`[`0`]` = 9 # set the first element
p1.x # convenience property (.y and .z also available)
p1.xi # idem, but rounded to nearest integer
p1.distance(p2) # calculate distance
p1 + p2 # calculate the addition of the two vectors
p2 = p1*2 # scale vector
p2 = p1 * p2 # even for each dimension seperately
p2 = p2.normalize() # make unit length
The Point class implements the following properties:
data, x, xi, y, yi, z, zi
The Point class implements the following methods:
copy
Get the point as the (2D) numpy array it is stored in.
Get/set p[
0]
.
Get p[
0]
rounded to the nearest integer, for indexing.
Get/set p[
1]
.
Get p[
1]
rounded to the nearest integer, for indexing.
Get/set p[
2]
.
Get p[
2]
rounded to the nearest integer, for indexing.
Get a copy of this point.