Class Eymiha::Point3c
In: lib/eymiha/math3/point3c.rb
Parent: Object

Point3c represents a 3D point in cylindrical coordinates:

  • c_radius is the distance from the cylindrical axis.
  • theta is the angular distance around the cylindrical axis.
  • z is the distance from the cylindrical base-plane.

The cylindrical theta coordinate is equal to the spherical theta. The cylindrical z coordinate is equal to the cartesian z coordinate.

From a cartesian reference, the cylindrical axis is the z axis, theta is measured using the right hand rule with the positive x axis representing 0, and the cylindrical plane is the plane z=0.

Point3c instances may be converted to Point3 and Point3s instances, but information at the "boundaries" may be lost. Besides responding as a Point3c, an instance will also respond like a Point3 and Point3s as it has a full complement of readers for the different coordinate systems.

Methods

==   =~   approximately_equals?   new   phi   point3   point3c   point3s   s_radius   set   theta=   to_s   x   y  

Included Modules

ThreeDimensions

Attributes

c_radius  [RW]  cylindrical radius coordinate reader and writer.
theta  [R]  cylindrical theta reader.
z  [RW]  cylindrical z coordinate reader and writer.

Public Class methods

Creates and returns a Point3c instance. Sets the coordinates values using the set method.

Public Instance methods

Returns true if the coordinates of the instance are effectively equal to the coordinates of the given point.

=~(point3c,epsilon=Numeric.epsilon)

Alias for approximately_equals?

Returns true if the coordinates of the instance are approximately effectively equal to the coordinates of the given point, each coordinate less than a distance epsilon from the target.

Returns the spherical phi coordinate of the instance.

Returns a 3D point in cartesian coordinates, filling point3 if given, and copied from point3c.

Returns a copy of point3c with the given cylindrical coordinates:

  • c_radius is Numeric, the arguments are copied as the coordinates.
  • c_radius responds like a Point3c, its coordinates are copied.
  • otherwise a TypeError is raised.

Returns a 3D point in spherical coordinates, filling point3s if given, and copied from point3c.

Returns the spherical radius coordinate of the instance.

Sets the coordinate values of the instance. When

  • c_radius is Numeric, the arguments are interpretted as coordinates.
  • c_radius responds like a Point3c, its cylindrical coordinates are assigned.
  • otherwise a TypeError is raised.

The modified instance is returned.

cylindrical theta coordinate writer, rectifying theta to a value in [0, 2*pi).

Returns a string representation of the instance.

Returns the cartesian x coordinate of the instance.

Returns the cartesian y coordinate of the instance.

[Validate]