Skip to content

Commit

Permalink
add JSDOC to Plane3 (see #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
veillette committed Jun 28, 2016
1 parent 1da192a commit 5e48fdf
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions js/Plane3.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ define( function( require ) {
var dot = require( 'DOT/dot' );
var Vector3 = require( 'DOT/Vector3' );

/*
* @constructor
/**
*
* @param {Vector3} normal - A normal vector (perpendicular) to the plane
* @param {number} distance - The signed distance to the plane from the origin, so that normal.times( distance )
* will be a point on the plane.
* @constructor
*/
function Plane3( normal, distance ) {
this.normal = normal;
this.distance = distance;
this.normal = normal; // @public (read-only)
this.distance = distance; // @public (read-only)

assert && assert( Math.abs( normal.magnitude() - 1 ) < 0.01 );
assert && assert( Math.abs( normal.magnitude() - 1 ) < 0.01, 'the normal vector must be a unit vector' );

phetAllocation && phetAllocation( 'Plane3' );
}
Expand All @@ -33,9 +34,11 @@ define( function( require ) {
Plane3.prototype = {
constructor: Plane3,

/*
/**
* Returns the intersection point of a ray with this plane.
* @public
* @param {Ray3} ray
* @returns The intersection {Vector3} of the ray with the plane
* @returns {Vector3}
*/
intersectWithRay: function( ray ) {
return ray.pointAtDistance( ray.distanceToPlane( this ) );
Expand All @@ -46,10 +49,15 @@ define( function( require ) {
Plane3.XZ = new Plane3( new Vector3( 0, 1, 0 ), 0 );
Plane3.YZ = new Plane3( new Vector3( 1, 0, 0 ), 0 );

/*
/**
* Returns a new plane that passes through three points $(\vec{a},\vec{b},\vec{c})$
* The normal of the plane points along $\vec{c-a} \times \vec{b-a}$
* Passing three collinear points will return null
* @public
* @param {Vector3} a - first point
* @param {Vector3} b - second point
* @param {Vector3} c - third point
* @returns {Plane3|null}
*/
Plane3.fromTriangle = function( a, b, c ) {
var normal = ( c.minus( a ) ).cross( b.minus( a ) );
Expand Down

0 comments on commit 5e48fdf

Please sign in to comment.