Skip to content

Instantly share code, notes, and snippets.

@tbrosman
Created August 13, 2014 05:55
Show Gist options
  • Save tbrosman/1cf18e864ba4d75192cc to your computer and use it in GitHub Desktop.
Save tbrosman/1cf18e864ba4d75192cc to your computer and use it in GitHub Desktop.
BaseFrame2.hx
package hxmath.frames;
import hxmath.math.Matrix2x2;
import hxmath.math.Matrix3x2;
import hxmath.math.Vector2;
/**
* An abstract 2D affine frame that can be extended without carrying over all the variables of the full Frame2 class.
*/
class BaseFrame2
{
// The associated affine transformation matrix. The private variable holds the cached/last calculated matrix.
public var matrix(get, never):Matrix3x2;
// The associated linear transformation matrix
public var linearMatrix(get, never):Matrix2x2;
// The offset between the origin and the outer frame
public var offset(get, set):Vector2;
// The angle by which the frame is rotated about the origin
public var angleDegrees(get, set):Float;
/**
* Constructor. Private to avoid direct instantiation (should be used as a base class only).
*/
private function new()
{
}
private function get_matrix():Matrix3x2
{
throw "Unimplemented";
}
private inline function get_linearMatrix():Matrix2x2
{
return matrix.linearSubMatrix;
}
private function get_offset():Vector2
{
throw "Unimplemented";
}
private function set_offset(offset:Vector2):Vector2
{
throw "Unimplemented";
}
private function get_angleDegrees():Float
{
throw "Unimplemented";
}
private function set_angleDegrees(angleDegrees:Float):Float
{
throw "Unimplemented";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment