Reference page for Point

Contents

Summary

POINT Class for representing points in a geometry.

Point objects are typically used for defining Surface objects, to be meshed later.

Point objects behave in many ways like 2x1 vectors, allowing the operations

Furthermore, the following operations are often useful for creating geometries for radial-flux motors:


PROPERTIES


METHODS

Class methods are listed below. Inherited methods are not included.

this = Point(arguments) Constructor.

this = Point([x,y], lcar)

Create a new point at (x,y) with the characteristic length lcar.

this.angle(arguments) Angular coordinate.

theta = angle(this)

Returns the angular coordinate theta = atan2(this.y, this.x)

this.copy(arguments) Return a deep copy.

Returns a new point with the same coordinates and characteristic length.

this.minus(arguments) Minus operator.

See Point.plus.

this.mirror(arguments) Mirroring across a segment center.

p2 = mirror(this, theta)

Returns a new Point, *mirror*ed around the center of a circle segment of theta radians. For instance, if

angle(P) = 30 deg,

then angle(P.*mirror*(pi/4)) = 60 deg.

this.mirror_inplace(arguments) Mirror in-place.

The same as mirror, but instead of returning a new Point modifies this.

this.mrdivide(arguments) Scale coordinates by dividing with a scalar.

p2 = P1 / a

Returns a new Point p2, at (P1.x/a, P1.y/x), with the characteristic length equal to P1.lcar.

this.mtimes(arguments) Scale coordinates by multiplying with a scalar.

p2 = P1 * a

Returns a new Point p2, at (P1.x*a, P1.y*x), with the characteristic length equal to P1.lcar.

this.norm(arguments) Radial coordinate.

r = norm(this)

Returns the radial coordinate r = sqrt( this.x^2 + this.y^2 ).

this.normalize(arguments) point distance from origin.

this = normalize(this, new_r)

Modifies the coordinates of this point so that its distance from origin (norm(this)) is equal to new_r. The angular coordinate angle(this) remains unchanged.

this.plot(arguments) Plot point.

plot(this, text, args)

Plots the point using the marker style etc specified in args, annotated with text. Supply an empty string to skip.

this.plus(arguments) Plus operator.

pnew = p1 + p2

Returns a new point at (p1.x + p2.x, p1.y + p2.y), with a characteristic length equal to p1.lcar.

Also works when p is a 2-vector.

this.rotate(arguments) Create a new Point, rotated around the origin.

p2 = rotate(this, theta)

Return a new Point, *rotate*d around the origin by theta radians.

rotate Rotate this point around the origin.

p2 = rotate(this, theta)

Rotate this Point around the origin by theta radians.

this.translate(arguments) Create a new translated point.

pnew = translate(this, s)

Returns a new Point, *translate*d with the vector s.

pnew = translate(this, s, lcar)

In addition to above, updates the characteristic length of the new Point.

this.translate_inplace(arguments) Translation inplace.

this = translate_inplace(this, Point)

Sets the coordinates of this equal to (Point.x, Point.y)

this = translate_inplace(this, [x, y])

Sets the coordinates of this equal to (x, y)

this.xmirror(arguments) Return a new Point, mirrored around the x-axis.

p2 = xmirror(this, x)

Returns a new Point at (x - this.x, this.y).

p2 = xmirror(this, x, lcar)

In addition to the above, sets the characteristic length of p2 to lcar.

this.ymirror(arguments) Return a new Point, mirrored around the y-axis.

p2 = ymirror(this, y)

Returns a new Point at (this.x, y-_this_.y).

p2 = ymirror(this)

Equivalent to p2 = ymirror(this, 0)

p2 = ymirror(this, y, lcar)

In addition to the above, sets the characteristic length of p2 to lcar.