class tinylib.Point3D

Available on all platforms

Point3D: 3-dimensional position of vector corresponding

This class is derived from Sandy Point3D.

Class Fields

static var EPSILON:Float

A small value. If the norm() is smaller than this value, normalize() function do clear() instead of normalization.

static function fromString(s:String):Point3D

Generate Point3D from String.

The string should have at least three space-separated float values. For example, "1.0 2.0 3.0" and " 1.0 2.0 3.0 " are valid.

static function fromStringInverted(s:String):Point3D

Generate Point3D from String. See also fromString() function.

The only difference of this function from fromString() is z-value is inverted in this function.

static function getAdd(p0:Point3D, p1:Point3D):Point3D

returns new Point3D of p0 + p1

static function getCross(p0:Point3D, p1:Point3D):Point3D

returns new Point3D of vector product p0 * p1

static function getMiddle(p0:Point3D, p1:Point3D, c:Bool, r:Float, o:Point3D):Point3D

returns middle point of p0 and p1. Default of the optional values are:

  • c: false
  • r: 0.0
  • o: null

If c is false (default), returns ( p0 + p1 ) / 2.

If c is true and o == null (default), returns r * ( p0 + p1 ) / | p0 + p1 |.

If c is true and o != null, returns r * ( p0 + p1 - 2o) / | p0 + p1 - 2o| + o. o is used as the origin.

static function getMultiply(p:Point3D, f:Float):Point3D

returns new Point3D of f * p

static function getSub(p0:Point3D, p1:Point3D):Point3D

returns new Point3D of p0 - p1

Instance Fields

var x:Float

x component

var y:Float

y component

var z:Float

z component

function new(vx:Float, vy:Float, vz:Float):Void

Constructor. Initial value can be assigned by vx, vy, and vz.

function add(p:Point3D):Point3D

add p to this instance and return this

function clear():Void

alias of nullify

function clone():Point3D

returns a copy of this instance

function cross(p:Point3D):Point3D

calculate vector product of this and p and replace this. return value is this.

function dot(p:Point3D):Float

returns dot product of this and p

function getAngle(p:Point3D):Float

returns angle between this and p.

The vlaue is calculated as acos( this * p / ( norm() * p.norm() ) ).

function get_x():Float

getter of x

function get_y():Float

getter of y

function get_z():Float

getter of z

function multiply(f:Float):Point3D

multiply float value f to this instance and return this

function norm():Float

returns norm

function normalize():Point3D

normalize this

function nullify():Void

x = y = z = 0.0

function removeParallel(p:Point3D):Point3D

remove a vector parallel to p from this instance.

function set_x(v:Float):Float

setter of x

function set_y(v:Float):Float

setter of y

function set_z(v:Float):Float

setter of z

function sqabs():Float

returns xx + yy + z*z

function sub(p:Point3D):Point3D

subtract p from this instance and return this

function toString():String

convert to space-separated string

function toVector3D():Vector3D

convert Point3D (x,y,z) to flash.geom.Vector3D (x,y,z,1.0)