File: src\geom\IntersectResult.ts
/**
*
* @module Kiwi
* @submodule Geom
*/
module Kiwi.Geom {
/**
* A Lightweight object to hold the results of an Intersection.
* Used in combination with the STATIC methods on the Intersect class.
*
* If you are using the Intersect methods a lot, you may want to consider
* creating a IntersectResult class a reusing it (by passing it to the methods on the Intersect class)
* instead of having new IntersectResults created.
*
*
* @class IntersectResult
* @namespace Kiwi.Geom
* @constructor
*/
export class IntersectResult {
/**
* The type of object this is.
* @method objType
* @return {String} "IntersectResult"
* @public
*/
public objType() {
return "IntersectResult";
}
/**
* Holds the result of an Intersection between two geometric items.
* TRUE means an Intersection did occur and FALSE means not.
* @property result
* @type boolean
* @default false
* @public
*/
public result: boolean = false;
/**
* Holds the x coordinate of the point in which the Intersection occured.
* Note: This is only set in the case the TWO geometric items are either Lines or Rays (Line like in function)
* and a Intersection occured.
* @property x
* @type Number
* @public
*/
public x: number;
/**
* Holds the y coordinate of the point in which the Intersection occured.
* Note: This is only set in the case the TWO geometric items are either Lines or Rays (Line like in function)
* and a Intersection occured.
* @property y
* @type Number
* @public
*/
public y: number;
/**
* [CURRENTLY NOT IN USE]
* @property x1
* @type Number
* @public
*/
public x1: number;
/**
* [CURRENTLY NOT IN USE]
* @property y1
* @type Number
* @public
*/
public y1: number;
/**
* [CURRENTLY NOT IN USE]
* @property x2
* @type Number
* @public
*/
public x2: number;
/**
* [CURRENTLY NOT IN USE]
* @property y2
* @type Number
* @public
*/
public y2: number;
/**
* [CURRENTLY NOT IN USE]
* @property width
* @type Number
* @public
*/
public width: number;
/**
* [CURRENTLY NOT IN USE]
* @property height
* @type Number
* @public
*/
public height: number;
/**
* Sets the coordinates of the points based on the parameters passed.
* @method setTo
* @param {Number} x1
* @param {Number} y1
* @param {Number} [x2=0]
* @param {Number} [y2=0]
* @param {Number} [width=0]
* @param {Number} [height=0]
* @public
*/
public setTo(x1: number, y1: number, x2: number = 0, y2: number = 0, width: number = 0, height: number = 0) {
this.x = x1;
this.y = y1;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.width = width;
this.height = height;
}
}
}