blob: df160c4c3ed5ee892d4b10c5531b43a15401c427 [file] [log] [blame]
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of vector_math_64;
/// Defines a quad by four points.
class Quad {
final Vector3 _point0;
final Vector3 _point1;
final Vector3 _point2;
final Vector3 _point3;
/// The first point of the quad.
Vector3 get point0 => _point0;
/// The second point of the quad.
Vector3 get point1 => _point1;
/// The third point of the quad.
Vector3 get point2 => _point2;
/// The third point of the quad.
Vector3 get point3 => _point3;
/// Create a new, uninitialized quad.
: _point0 =,
_point1 =,
_point2 =,
_point3 =;
/// Create a quad as a copy of [other].
Quad.copy(Quad other)
: _point0 = Vector3.copy(other._point0),
_point1 = Vector3.copy(other._point1),
_point2 = Vector3.copy(other._point2),
_point3 = Vector3.copy(other._point2);
/// Create a quad by four points.
Quad.points(Vector3 point0, Vector3 point1, Vector3 point2, Vector3 point3)
: _point0 = Vector3.copy(point0),
_point1 = Vector3.copy(point1),
_point2 = Vector3.copy(point2),
_point3 = Vector3.copy(point3);
/// Copy the quad from [other] into this.
void copyFrom(Quad other) {
/// Copy the normal of this into [normal].
void copyNormalInto(Vector3 normal) {
final v0 = _point0.clone()..sub(_point1);
..crossInto(v0, normal)
/// Copies the two triangles that define this.
void copyTriangles(Triangle triangle0, Triangle triangle1) {
/// Transform this by the transform [t].
void transform(Matrix4 t) {
/// Translate this by [offset].
void translate(Vector3 offset) {