Many lints!
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 954dcf6..f7729bb 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -4,8 +4,90 @@
# implicit-casts: false
linter:
rules:
+ - always_declare_return_types
+ - annotate_overrides
+ - avoid_bool_literals_in_conditional_expressions
+ - avoid_classes_with_only_static_members
+ - avoid_empty_else
+ - avoid_function_literals_in_foreach_calls
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_relative_lib_imports
+ - avoid_renaming_method_parameters
+ - avoid_return_types_on_setters
+ #- avoid_returning_null
+ - avoid_returning_null_for_future
+ - avoid_returning_null_for_void
+ - avoid_returning_this
+ - avoid_shadowing_type_parameters
+ - avoid_single_cascade_in_expression_statements
+ - avoid_types_as_parameter_names
+ - avoid_unused_constructor_parameters
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ #- cascade_invocations
+ #- comment_references
+ #- constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - file_names
+ - hash_and_equals
+ - implementation_imports
+ - invariant_booleans
+ - iterable_contains_unrelated_type
+ - join_return_with_assignment
+ - library_names
+ - library_prefixes
+ - list_remove_unrelated_type
+ - literal_only_boolean_expressions
+ - no_adjacent_strings_in_list
+ - no_duplicate_case_values
+ #- non_constant_identifier_names
+ - null_closures
+ #- omit_local_variable_types
+ - only_throw_errors
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - prefer_adjacent_string_concatenation
+ - prefer_collection_literals
+ - prefer_conditional_assignment
+ - prefer_const_constructors
+ - prefer_contains
- prefer_equal_for_default_values
+ - prefer_final_fields
+ #- prefer_final_locals
- prefer_generic_function_type_aliases
+ - prefer_initializing_formals
+ - prefer_interpolation_to_compose_strings
+ - prefer_is_empty
+ - prefer_is_not_empty
+ - prefer_null_aware_operators
+ #- prefer_single_quotes
+ - prefer_typing_uninitialized_variables
+ - recursive_getters
- slash_for_doc_comments
+ - test_types_in_equals
+ - throw_in_finally
+ - type_init_formals
+ - unawaited_futures
+ - unnecessary_await_in_return
+ - unnecessary_brace_in_string_interps
- unnecessary_const
+ - unnecessary_getters_setters
+ - unnecessary_lambdas
- unnecessary_new
+ - unnecessary_null_aware_assignments
+ - unnecessary_parenthesis
+ - unnecessary_statements
+ - unnecessary_this
+ - unrelated_type_equality_checks
+ - use_function_type_syntax_for_parameters
+ - use_rethrow_when_possible
+ - valid_regexps
+ - void_checks
diff --git a/lib/src/vector_math/aabb3.dart b/lib/src/vector_math/aabb3.dart
index aa47b65..57f3f12 100644
--- a/lib/src/vector_math/aabb3.dart
+++ b/lib/src/vector_math/aabb3.dart
@@ -76,10 +76,10 @@
/// Set the AABB to enclose a [sphere].
void setSphere(Sphere sphere) {
_min
- ..splat(-sphere._radius)
+ ..splat(-sphere.radius)
..add(sphere._center);
_max
- ..splat(sphere._radius)
+ ..splat(sphere.radius)
..add(sphere._center);
}
@@ -299,7 +299,7 @@
/// Return if [this] contains [other].
bool containsSphere(Sphere other) {
- final Vector3 boxExtends = Vector3.all(other._radius);
+ final Vector3 boxExtends = Vector3.all(other.radius);
final Aabb3 sphereBox =
Aabb3.centerAndHalfExtents(other._center, boxExtends);
@@ -337,7 +337,7 @@
/// Return if [this] intersects with [other].
bool intersectsWithSphere(Sphere other) {
final Vector3 center = other._center;
- final double radius = other._radius;
+ final double radius = other.radius;
double d = 0.0;
double e = 0.0;
diff --git a/lib/src/vector_math/frustum.dart b/lib/src/vector_math/frustum.dart
index cbb89a7..6342550 100644
--- a/lib/src/vector_math/frustum.dart
+++ b/lib/src/vector_math/frustum.dart
@@ -144,7 +144,7 @@
/// Check if [this] intersects with [sphere].
bool intersectsWithSphere(Sphere sphere) {
- final double negativeRadius = -sphere._radius;
+ final double negativeRadius = -sphere.radius;
final Vector3 center = sphere.center;
if (_plane0.distanceToVector3(center) < negativeRadius) {
@@ -225,11 +225,11 @@
final double d1 = plane._normal.x * outPx +
plane._normal.y * outPy +
plane._normal.z * outPz +
- plane._constant;
+ plane.constant;
final double d2 = plane._normal.x * outNx +
plane._normal.y * outNy +
plane._normal.z * outNz +
- plane._constant;
+ plane.constant;
return d1 < 0 && d2 < 0;
}
diff --git a/lib/src/vector_math/matrix4.dart b/lib/src/vector_math/matrix4.dart
index 03733a4..ca9b056 100644
--- a/lib/src/vector_math/matrix4.dart
+++ b/lib/src/vector_math/matrix4.dart
@@ -1252,7 +1252,7 @@
final double b10 = a21 * a33 - a23 * a31;
final double b11 = a22 * a33 - a23 * a32;
final double det =
- (b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06);
+ b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (det == 0.0) {
setFrom(arg);
return 0.0;
diff --git a/lib/src/vector_math/opengl.dart b/lib/src/vector_math/opengl.dart
index af40f1a..6d93fb1 100644
--- a/lib/src/vector_math/opengl.dart
+++ b/lib/src/vector_math/opengl.dart
@@ -267,7 +267,7 @@
Matrix4 r = Matrix4.zero();
r = r - outer;
final Vector3 scaledNormal =
- (planeNormal.scaled(dot3(planePoint, planeNormal)));
+ planeNormal.scaled(dot3(planePoint, planeNormal));
final Vector4 T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1],
scaledNormal.storage[2], 1.0);
r.setColumn(3, T);
@@ -283,7 +283,7 @@
Matrix4 r = Matrix4.zero();
r = r - outer;
final double scale = 2.0 * planePoint.dot(planeNormal);
- final Vector3 scaledNormal = (planeNormal.scaled(scale));
+ final Vector3 scaledNormal = planeNormal.scaled(scale);
final Vector4 T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1],
scaledNormal.storage[2], 1.0);
r.setColumn(3, T);
@@ -317,8 +317,8 @@
viewportHeight = viewportHeight.toDouble();
pickX = pickX.toDouble();
pickY = pickY.toDouble();
- pickX = (pickX - viewportX);
- pickY = (pickY - viewportY);
+ pickX = pickX - viewportX;
+ pickY = pickY - viewportY;
pickX = (2.0 * pickX / viewportWidth) - 1.0;
pickY = (2.0 * pickY / viewportHeight) - 1.0;
pickZ = (2.0 * pickZ) - 1.0;
@@ -381,8 +381,6 @@
return false;
}
- r = unproject(cameraMatrix, viewportX, viewportWidth, viewportY,
+ return unproject(cameraMatrix, viewportX, viewportWidth, viewportY,
viewportHeight, pickX, viewportHeight - pickY, 1.0, rayFar);
-
- return r;
}
diff --git a/lib/src/vector_math/plane.dart b/lib/src/vector_math/plane.dart
index a22e473..0008e70 100644
--- a/lib/src/vector_math/plane.dart
+++ b/lib/src/vector_math/plane.dart
@@ -6,7 +6,7 @@
class Plane {
final Vector3 _normal;
- double _constant;
+ double constant;
/// Find the intersection point between the three planes [a], [b] and [c] and
/// copy it into [result].
@@ -34,40 +34,36 @@
}
Vector3 get normal => _normal;
- double get constant => _constant;
- set constant(double value) => _constant = value;
Plane()
: _normal = Vector3.zero(),
- _constant = 0.0;
+ constant = 0.0;
Plane.copy(Plane other)
: _normal = Vector3.copy(other._normal),
- _constant = other._constant;
+ constant = other.constant;
- Plane.components(double x, double y, double z, double w)
- : _normal = Vector3(x, y, z),
- _constant = w;
+ Plane.components(double x, double y, double z, this.constant)
+ : _normal = Vector3(x, y, z);
- Plane.normalconstant(Vector3 normal_, double constant_)
- : _normal = Vector3.copy(normal_),
- _constant = constant_;
+ Plane.normalconstant(Vector3 normal_, this.constant)
+ : _normal = Vector3.copy(normal_);
void copyFrom(Plane o) {
_normal.setFrom(o._normal);
- _constant = o._constant;
+ constant = o.constant;
}
void setFromComponents(double x, double y, double z, double w) {
_normal.setValues(x, y, z);
- _constant = w;
+ constant = w;
}
void normalize() {
final double inverseLength = 1.0 / normal.length;
_normal.scale(inverseLength);
- _constant *= inverseLength;
+ constant *= inverseLength;
}
- double distanceToVector3(Vector3 point) => _normal.dot(point) + _constant;
+ double distanceToVector3(Vector3 point) => _normal.dot(point) + constant;
}
diff --git a/lib/src/vector_math/ray.dart b/lib/src/vector_math/ray.dart
index b782007..4eaac12 100644
--- a/lib/src/vector_math/ray.dart
+++ b/lib/src/vector_math/ray.dart
@@ -51,7 +51,7 @@
/// Return the distance from the origin of [this] to the intersection with
/// [other] if [this] intersects with [other], or null if the don't intersect.
double intersectsWithSphere(Sphere other) {
- final double r = other._radius;
+ final double r = other.radius;
final double r2 = r * r;
final Vector3 l = other._center.clone()..sub(_origin);
final double s = l.dot(_direction);
diff --git a/lib/src/vector_math/sphere.dart b/lib/src/vector_math/sphere.dart
index 3b4e082..b726f05 100644
--- a/lib/src/vector_math/sphere.dart
+++ b/lib/src/vector_math/sphere.dart
@@ -7,34 +7,31 @@
/// Defines a sphere with a [center] and a [radius].
class Sphere {
final Vector3 _center;
- double _radius;
+
+ /// The [radius] of the sphere.
+ double radius;
/// The [center] of the sphere.
Vector3 get center => _center;
- /// The [radius] of the sphere.
- double get radius => _radius;
- set radius(double value) => _radius = value;
-
/// Create a new, uninitialized sphere.
Sphere()
: _center = Vector3.zero(),
- _radius = 0.0;
+ radius = 0.0;
/// Create a sphere as a copy of [other].
Sphere.copy(Sphere other)
: _center = Vector3.copy(other._center),
- _radius = other._radius;
+ radius = other.radius;
/// Create a sphere from a [center] and a [radius].
- Sphere.centerRadius(Vector3 center, double radius)
- : _center = Vector3.copy(center),
- _radius = radius;
+ Sphere.centerRadius(Vector3 center, this.radius)
+ : _center = Vector3.copy(center);
/// Copy the sphere from [other] into [this].
void copyFrom(Sphere other) {
_center.setFrom(other._center);
- _radius = other._radius;
+ radius = other.radius;
}
/// Return if [this] contains [other].
diff --git a/lib/src/vector_math/vector2.dart b/lib/src/vector_math/vector2.dart
index 81cd4d4..404c62b 100644
--- a/lib/src/vector_math/vector2.dart
+++ b/lib/src/vector_math/vector2.dart
@@ -149,8 +149,8 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v2storage[0] * _v2storage[0]);
- sum += (_v2storage[1] * _v2storage[1]);
+ sum = _v2storage[0] * _v2storage[0];
+ sum += _v2storage[1] * _v2storage[1];
return sum;
}
diff --git a/lib/src/vector_math/vector3.dart b/lib/src/vector_math/vector3.dart
index c117055..bdf0c94 100644
--- a/lib/src/vector_math/vector3.dart
+++ b/lib/src/vector_math/vector3.dart
@@ -159,9 +159,9 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v3storage[0] * _v3storage[0]);
- sum += (_v3storage[1] * _v3storage[1]);
- sum += (_v3storage[2] * _v3storage[2]);
+ sum = _v3storage[0] * _v3storage[0];
+ sum += _v3storage[1] * _v3storage[1];
+ sum += _v3storage[2] * _v3storage[2];
return sum;
}
diff --git a/lib/src/vector_math/vector4.dart b/lib/src/vector_math/vector4.dart
index a35b1e7..6d88e24 100644
--- a/lib/src/vector_math/vector4.dart
+++ b/lib/src/vector_math/vector4.dart
@@ -181,10 +181,10 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v4storage[0] * _v4storage[0]);
- sum += (_v4storage[1] * _v4storage[1]);
- sum += (_v4storage[2] * _v4storage[2]);
- sum += (_v4storage[3] * _v4storage[3]);
+ sum = _v4storage[0] * _v4storage[0];
+ sum += _v4storage[1] * _v4storage[1];
+ sum += _v4storage[2] * _v4storage[2];
+ sum += _v4storage[3] * _v4storage[3];
return sum;
}
diff --git a/lib/src/vector_math_64/aabb3.dart b/lib/src/vector_math_64/aabb3.dart
index 5124b4d..ba4ed5f 100644
--- a/lib/src/vector_math_64/aabb3.dart
+++ b/lib/src/vector_math_64/aabb3.dart
@@ -76,10 +76,10 @@
/// Set the AABB to enclose a [sphere].
void setSphere(Sphere sphere) {
_min
- ..splat(-sphere._radius)
+ ..splat(-sphere.radius)
..add(sphere._center);
_max
- ..splat(sphere._radius)
+ ..splat(sphere.radius)
..add(sphere._center);
}
@@ -299,7 +299,7 @@
/// Return if [this] contains [other].
bool containsSphere(Sphere other) {
- final Vector3 boxExtends = Vector3.all(other._radius);
+ final Vector3 boxExtends = Vector3.all(other.radius);
final Aabb3 sphereBox =
Aabb3.centerAndHalfExtents(other._center, boxExtends);
@@ -337,7 +337,7 @@
/// Return if [this] intersects with [other].
bool intersectsWithSphere(Sphere other) {
final Vector3 center = other._center;
- final double radius = other._radius;
+ final double radius = other.radius;
double d = 0.0;
double e = 0.0;
diff --git a/lib/src/vector_math_64/frustum.dart b/lib/src/vector_math_64/frustum.dart
index 05966ae..1f0af9b 100644
--- a/lib/src/vector_math_64/frustum.dart
+++ b/lib/src/vector_math_64/frustum.dart
@@ -144,7 +144,7 @@
/// Check if [this] intersects with [sphere].
bool intersectsWithSphere(Sphere sphere) {
- final double negativeRadius = -sphere._radius;
+ final double negativeRadius = -sphere.radius;
final Vector3 center = sphere.center;
if (_plane0.distanceToVector3(center) < negativeRadius) {
@@ -225,11 +225,11 @@
final double d1 = plane._normal.x * outPx +
plane._normal.y * outPy +
plane._normal.z * outPz +
- plane._constant;
+ plane.constant;
final double d2 = plane._normal.x * outNx +
plane._normal.y * outNy +
plane._normal.z * outNz +
- plane._constant;
+ plane.constant;
return d1 < 0 && d2 < 0;
}
diff --git a/lib/src/vector_math_64/matrix4.dart b/lib/src/vector_math_64/matrix4.dart
index 6ff4c05..0c746ca 100644
--- a/lib/src/vector_math_64/matrix4.dart
+++ b/lib/src/vector_math_64/matrix4.dart
@@ -1252,7 +1252,7 @@
final double b10 = a21 * a33 - a23 * a31;
final double b11 = a22 * a33 - a23 * a32;
final double det =
- (b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06);
+ b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (det == 0.0) {
setFrom(arg);
return 0.0;
diff --git a/lib/src/vector_math_64/opengl.dart b/lib/src/vector_math_64/opengl.dart
index d343e50..c34e5ed 100644
--- a/lib/src/vector_math_64/opengl.dart
+++ b/lib/src/vector_math_64/opengl.dart
@@ -267,7 +267,7 @@
Matrix4 r = Matrix4.zero();
r = r - outer;
final Vector3 scaledNormal =
- (planeNormal.scaled(dot3(planePoint, planeNormal)));
+ planeNormal.scaled(dot3(planePoint, planeNormal));
final Vector4 T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1],
scaledNormal.storage[2], 1.0);
r.setColumn(3, T);
@@ -283,7 +283,7 @@
Matrix4 r = Matrix4.zero();
r = r - outer;
final double scale = 2.0 * planePoint.dot(planeNormal);
- final Vector3 scaledNormal = (planeNormal.scaled(scale));
+ final Vector3 scaledNormal = planeNormal.scaled(scale);
final Vector4 T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1],
scaledNormal.storage[2], 1.0);
r.setColumn(3, T);
@@ -317,8 +317,8 @@
viewportHeight = viewportHeight.toDouble();
pickX = pickX.toDouble();
pickY = pickY.toDouble();
- pickX = (pickX - viewportX);
- pickY = (pickY - viewportY);
+ pickX = pickX - viewportX;
+ pickY = pickY - viewportY;
pickX = (2.0 * pickX / viewportWidth) - 1.0;
pickY = (2.0 * pickY / viewportHeight) - 1.0;
pickZ = (2.0 * pickZ) - 1.0;
@@ -381,8 +381,6 @@
return false;
}
- r = unproject(cameraMatrix, viewportX, viewportWidth, viewportY,
+ return unproject(cameraMatrix, viewportX, viewportWidth, viewportY,
viewportHeight, pickX, viewportHeight - pickY, 1.0, rayFar);
-
- return r;
}
diff --git a/lib/src/vector_math_64/plane.dart b/lib/src/vector_math_64/plane.dart
index 85dd558..82bdaab 100644
--- a/lib/src/vector_math_64/plane.dart
+++ b/lib/src/vector_math_64/plane.dart
@@ -6,7 +6,7 @@
class Plane {
final Vector3 _normal;
- double _constant;
+ double constant;
/// Find the intersection point between the three planes [a], [b] and [c] and
/// copy it into [result].
@@ -34,40 +34,36 @@
}
Vector3 get normal => _normal;
- double get constant => _constant;
- set constant(double value) => _constant = value;
Plane()
: _normal = Vector3.zero(),
- _constant = 0.0;
+ constant = 0.0;
Plane.copy(Plane other)
: _normal = Vector3.copy(other._normal),
- _constant = other._constant;
+ constant = other.constant;
- Plane.components(double x, double y, double z, double w)
- : _normal = Vector3(x, y, z),
- _constant = w;
+ Plane.components(double x, double y, double z, this.constant)
+ : _normal = Vector3(x, y, z);
- Plane.normalconstant(Vector3 normal_, double constant_)
- : _normal = Vector3.copy(normal_),
- _constant = constant_;
+ Plane.normalconstant(Vector3 normal_, this.constant)
+ : _normal = Vector3.copy(normal_);
void copyFrom(Plane o) {
_normal.setFrom(o._normal);
- _constant = o._constant;
+ constant = o.constant;
}
void setFromComponents(double x, double y, double z, double w) {
_normal.setValues(x, y, z);
- _constant = w;
+ constant = w;
}
void normalize() {
final double inverseLength = 1.0 / normal.length;
_normal.scale(inverseLength);
- _constant *= inverseLength;
+ constant *= inverseLength;
}
- double distanceToVector3(Vector3 point) => _normal.dot(point) + _constant;
+ double distanceToVector3(Vector3 point) => _normal.dot(point) + constant;
}
diff --git a/lib/src/vector_math_64/ray.dart b/lib/src/vector_math_64/ray.dart
index 3410444..8323e3f 100644
--- a/lib/src/vector_math_64/ray.dart
+++ b/lib/src/vector_math_64/ray.dart
@@ -51,7 +51,7 @@
/// Return the distance from the origin of [this] to the intersection with
/// [other] if [this] intersects with [other], or null if the don't intersect.
double intersectsWithSphere(Sphere other) {
- final double r = other._radius;
+ final double r = other.radius;
final double r2 = r * r;
final Vector3 l = other._center.clone()..sub(_origin);
final double s = l.dot(_direction);
diff --git a/lib/src/vector_math_64/sphere.dart b/lib/src/vector_math_64/sphere.dart
index 9dec718..4816042 100644
--- a/lib/src/vector_math_64/sphere.dart
+++ b/lib/src/vector_math_64/sphere.dart
@@ -7,34 +7,31 @@
/// Defines a sphere with a [center] and a [radius].
class Sphere {
final Vector3 _center;
- double _radius;
+
+ /// The [radius] of the sphere.
+ double radius;
/// The [center] of the sphere.
Vector3 get center => _center;
- /// The [radius] of the sphere.
- double get radius => _radius;
- set radius(double value) => _radius = value;
-
/// Create a new, uninitialized sphere.
Sphere()
: _center = Vector3.zero(),
- _radius = 0.0;
+ radius = 0.0;
/// Create a sphere as a copy of [other].
Sphere.copy(Sphere other)
: _center = Vector3.copy(other._center),
- _radius = other._radius;
+ radius = other.radius;
/// Create a sphere from a [center] and a [radius].
- Sphere.centerRadius(Vector3 center, double radius)
- : _center = Vector3.copy(center),
- _radius = radius;
+ Sphere.centerRadius(Vector3 center, this.radius)
+ : _center = Vector3.copy(center);
/// Copy the sphere from [other] into [this].
void copyFrom(Sphere other) {
_center.setFrom(other._center);
- _radius = other._radius;
+ radius = other.radius;
}
/// Return if [this] contains [other].
diff --git a/lib/src/vector_math_64/vector2.dart b/lib/src/vector_math_64/vector2.dart
index 8051b93..39048c8 100644
--- a/lib/src/vector_math_64/vector2.dart
+++ b/lib/src/vector_math_64/vector2.dart
@@ -149,8 +149,8 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v2storage[0] * _v2storage[0]);
- sum += (_v2storage[1] * _v2storage[1]);
+ sum = _v2storage[0] * _v2storage[0];
+ sum += _v2storage[1] * _v2storage[1];
return sum;
}
diff --git a/lib/src/vector_math_64/vector3.dart b/lib/src/vector_math_64/vector3.dart
index c6708af..8334dee 100644
--- a/lib/src/vector_math_64/vector3.dart
+++ b/lib/src/vector_math_64/vector3.dart
@@ -159,9 +159,9 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v3storage[0] * _v3storage[0]);
- sum += (_v3storage[1] * _v3storage[1]);
- sum += (_v3storage[2] * _v3storage[2]);
+ sum = _v3storage[0] * _v3storage[0];
+ sum += _v3storage[1] * _v3storage[1];
+ sum += _v3storage[2] * _v3storage[2];
return sum;
}
diff --git a/lib/src/vector_math_64/vector4.dart b/lib/src/vector_math_64/vector4.dart
index de245c1..99402a4 100644
--- a/lib/src/vector_math_64/vector4.dart
+++ b/lib/src/vector_math_64/vector4.dart
@@ -181,10 +181,10 @@
/// Length squared.
double get length2 {
double sum;
- sum = (_v4storage[0] * _v4storage[0]);
- sum += (_v4storage[1] * _v4storage[1]);
- sum += (_v4storage[2] * _v4storage[2]);
- sum += (_v4storage[3] * _v4storage[3]);
+ sum = _v4storage[0] * _v4storage[0];
+ sum += _v4storage[1] * _v4storage[1];
+ sum += _v4storage[2] * _v4storage[2];
+ sum += _v4storage[3] * _v4storage[3];
return sum;
}
diff --git a/lib/src/vector_math_geometry/generators/circle_generator.dart b/lib/src/vector_math_geometry/generators/circle_generator.dart
index 535cd77..54e3bff 100644
--- a/lib/src/vector_math_geometry/generators/circle_generator.dart
+++ b/lib/src/vector_math_geometry/generators/circle_generator.dart
@@ -14,7 +14,7 @@
int get vertexCount => _segments + 2;
@override
- int get indexCount => (_segments) * 3;
+ int get indexCount => _segments * 3;
MeshGeometry createCircle(double radius,
{GeometryGeneratorFlags flags,
diff --git a/lib/src/vector_math_geometry/generators/cylinder_generator.dart b/lib/src/vector_math_geometry/generators/cylinder_generator.dart
index 1787959..bdb8143 100644
--- a/lib/src/vector_math_geometry/generators/cylinder_generator.dart
+++ b/lib/src/vector_math_geometry/generators/cylinder_generator.dart
@@ -120,14 +120,14 @@
for (int x = 0; x < _segments; ++x) {
final double r = (x / _segments) * math.pi * 2.0;
texCoords[i++] =
- Vector2((math.cos(r) * 0.5 + 0.5), (math.sin(r) * 0.5 + 0.5));
+ Vector2(math.cos(r) * 0.5 + 0.5, math.sin(r) * 0.5 + 0.5);
}
// Bottom cap
for (int x = 0; x < _segments; ++x) {
final double r = (x / _segments) * math.pi * 2.0;
texCoords[i++] =
- Vector2((math.cos(r) * 0.5 + 0.5), (math.sin(r) * 0.5 + 0.5));
+ Vector2(math.cos(r) * 0.5 + 0.5, math.sin(r) * 0.5 + 0.5);
}
}
}
diff --git a/lib/src/vector_math_geometry/generators/ring_generator.dart b/lib/src/vector_math_geometry/generators/ring_generator.dart
index 9a9fd95..2e62801 100644
--- a/lib/src/vector_math_geometry/generators/ring_generator.dart
+++ b/lib/src/vector_math_geometry/generators/ring_generator.dart
@@ -16,7 +16,7 @@
int get vertexCount => (_segments + 1) * 2;
@override
- int get indexCount => (_segments) * 3 * 2;
+ int get indexCount => _segments * 3 * 2;
MeshGeometry createRing(double innerRadius, double outerRadius,
{GeometryGeneratorFlags flags,
diff --git a/lib/src/vector_math_operations/matrix.dart b/lib/src/vector_math_operations/matrix.dart
index 2a415e3..514419c 100644
--- a/lib/src/vector_math_operations/matrix.dart
+++ b/lib/src/vector_math_operations/matrix.dart
@@ -99,7 +99,7 @@
final double b10 = a21 * a33 - a23 * a31;
final double b11 = a22 * a33 - a23 * a32;
final double det =
- (b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06);
+ b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
if (det == 0.0) {
return det;
@@ -208,22 +208,22 @@
final double m4 = matrix[4 + matrixOffset];
final double m8 = matrix[8 + matrixOffset];
final double m12 = matrix[12 + matrixOffset];
- out[outOffset++] = (m0 * x + m4 * y + m8 * z + m12 * w);
+ out[outOffset++] = m0 * x + m4 * y + m8 * z + m12 * w;
final double m1 = matrix[1 + matrixOffset];
final double m5 = matrix[5 + matrixOffset];
final double m9 = matrix[9 + matrixOffset];
final double m13 = matrix[13 + matrixOffset];
- out[outOffset++] = (m1 * x + m5 * y + m9 * z + m13 * w);
+ out[outOffset++] = m1 * x + m5 * y + m9 * z + m13 * w;
final double m2 = matrix[2 + matrixOffset];
final double m6 = matrix[6 + matrixOffset];
final double m10 = matrix[10 + matrixOffset];
final double m14 = matrix[14 + matrixOffset];
- out[outOffset++] = (m2 * x + m6 * y + m10 * z + m14 * w);
+ out[outOffset++] = m2 * x + m6 * y + m10 * z + m14 * w;
final double m3 = matrix[3 + matrixOffset];
final double m7 = matrix[7 + matrixOffset];
final double m11 = matrix[11 + matrixOffset];
final double m15 = matrix[15 + matrixOffset];
- out[outOffset++] = (m3 * x + m7 * y + m11 * z + m15 * w);
+ out[outOffset++] = m3 * x + m7 * y + m11 * z + m15 * w;
}
/// Transform the 3D [vector] starting at [vectorOffset] by the 4x4 [matrix]
diff --git a/test/matrix2_test.dart b/test/matrix2_test.dart
index 33c4da1..d860263 100644
--- a/test/matrix2_test.dart
+++ b/test/matrix2_test.dart
@@ -13,8 +13,8 @@
import 'test_utils.dart';
void testMatrix2Adjoint() {
- var input = List<Matrix2>();
- var expectedOutput = List<Matrix2>();
+ var input = <Matrix2>[];
+ var expectedOutput = <Matrix2>[];
input.add(parseMatrix<Matrix2>('''0.830828627896291 0.549723608291140
0.585264091152724 0.917193663829810'''));
@@ -36,8 +36,8 @@
}
void testMatrix2Determinant() {
- var input = List<Matrix2>();
- List<double> expectedOutput = List<double>();
+ var input = <Matrix2>[];
+ List<double> expectedOutput = <double>[];
input.add(parseMatrix<Matrix2>('''0.830828627896291 0.549723608291140
0.585264091152724 0.917193663829810'''));
diff --git a/test/matrix3_test.dart b/test/matrix3_test.dart
index f04a5fd..2d191b3 100644
--- a/test/matrix3_test.dart
+++ b/test/matrix3_test.dart
@@ -13,8 +13,8 @@
import 'test_utils.dart';
void testMatrix3Adjoint() {
- var input = List<dynamic>();
- var expectedOutput = List<dynamic>();
+ var input = <dynamic>[];
+ var expectedOutput = <dynamic>[];
input.add(parseMatrix<Matrix3>(
''' 0.285839018820374 0.380445846975357 0.053950118666607
@@ -49,8 +49,8 @@
}
void testMatrix3Determinant() {
- var input = List<Matrix3>();
- List<double> expectedOutput = List<double>();
+ var input = <Matrix3>[];
+ List<double> expectedOutput = <double>[];
input.add(parseMatrix<Matrix3>(
'''0.285839018820374 0.380445846975357 0.053950118666607
@@ -68,9 +68,9 @@
}
void testMatrix3SelfTransposeMultiply() {
- var inputA = List<Matrix3>();
- var inputB = List<Matrix3>();
- var expectedOutput = List<Matrix3>();
+ var inputA = <Matrix3>[];
+ var inputB = <Matrix3>[];
+ var expectedOutput = <Matrix3>[];
inputA.add(parseMatrix<Matrix3>(
'''0.084435845510910 0.800068480224308 0.181847028302852
@@ -108,9 +108,9 @@
}
void testMatrix3SelfMultiply() {
- var inputA = List<Matrix3>();
- var inputB = List<Matrix3>();
- var expectedOutput = List<Matrix3>();
+ var inputA = <Matrix3>[];
+ var inputB = <Matrix3>[];
+ var expectedOutput = <Matrix3>[];
inputA.add(parseMatrix<Matrix3>(
'''0.084435845510910 0.800068480224308 0.181847028302852
@@ -148,9 +148,9 @@
}
void testMatrix3SelfMultiplyTranspose() {
- var inputA = List<Matrix3>();
- var inputB = List<Matrix3>();
- var expectedOutput = List<Matrix3>();
+ var inputA = <Matrix3>[];
+ var inputB = <Matrix3>[];
+ var expectedOutput = <Matrix3>[];
inputA.add(parseMatrix<Matrix3>(
'''0.084435845510910 0.800068480224308 0.181847028302852
diff --git a/test/matrix4_test.dart b/test/matrix4_test.dart
index 204583d..f7a4383 100644
--- a/test/matrix4_test.dart
+++ b/test/matrix4_test.dart
@@ -118,8 +118,8 @@
}
void testMatrix4Transpose() {
- var inputA = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466
0.900053846417662 0.389738836961253 0.131973292606335 0.059779542947156
@@ -134,9 +134,9 @@
}
void testMatrix4VectorMultiplication() {
- var inputA = List<Matrix4>();
- var inputB = List<Vector4>();
- var expectedOutput = List<Vector4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Vector4>[];
+ var expectedOutput = <Vector4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466
@@ -162,9 +162,9 @@
}
void testMatrix4Multiplication() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.587044704531417 0.230488160211558 0.170708047147859 0.923379642103244
@@ -193,8 +193,8 @@
}
void testMatrix4Adjoint() {
- var input = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var input = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
input.add(parseMatrix<Matrix4>(
'''0.934010684229183 0.011902069501241 0.311215042044805 0.262971284540144
@@ -236,8 +236,8 @@
}
void testMatrix4Determinant() {
- var input = List<Matrix4>();
- List<double> expectedOutput = List<double>();
+ var input = <Matrix4>[];
+ List<double> expectedOutput = <double>[];
input.add(parseMatrix<Matrix4>(
'''0.046171390631154 0.317099480060861 0.381558457093008 0.489764395788231
0.097131781235848 0.950222048838355 0.765516788149002 0.445586200710899
@@ -268,9 +268,9 @@
}
void testMatrix4SelfTransposeMultiply() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
@@ -299,9 +299,9 @@
}
void testMatrix4SelfMultiply() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
@@ -330,9 +330,9 @@
}
void testMatrix4SelfMultiplyTranspose() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var expectedOutput = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var expectedOutput = <Matrix4>[];
inputA.add(parseMatrix<Matrix4>(
'''0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067
@@ -361,10 +361,10 @@
}
void testMatrix4Translation() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var output1 = List<Matrix4>();
- var output2 = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var output1 = <Matrix4>[];
+ var output2 = <Matrix4>[];
inputA.add(Matrix4.identity());
inputB.add(Matrix4.translationValues(1.0, 3.0, 5.7));
@@ -380,10 +380,10 @@
}
void testMatrix4Scale() {
- var inputA = List<Matrix4>();
- var inputB = List<Matrix4>();
- var output1 = List<Matrix4>();
- var output2 = List<Matrix4>();
+ var inputA = <Matrix4>[];
+ var inputB = <Matrix4>[];
+ var output1 = <Matrix4>[];
+ var output2 = <Matrix4>[];
inputA.add(Matrix4.identity());
inputB.add(Matrix4.diagonal3Values(1.0, 3.0, 5.7));
@@ -399,8 +399,8 @@
}
void testMatrix4Rotate() {
- var output1 = List<Matrix4>();
- var output2 = List<Matrix4>();
+ var output1 = <Matrix4>[];
+ var output2 = <Matrix4>[];
output1.add(Matrix4.rotationX(1.57079632679));
output2.add(Matrix4.identity()..rotateX(1.57079632679));
output1.add(Matrix4.rotationY(1.57079632679 * 0.5));
diff --git a/test/quaternion_test.dart b/test/quaternion_test.dart
index 7536a93..2c8afef 100644
--- a/test/quaternion_test.dart
+++ b/test/quaternion_test.dart
@@ -4,11 +4,10 @@
library vector_math.test.quaternion_test;
-import 'dart:typed_data';
import 'dart:math' as math;
+import 'dart:typed_data';
import 'package:test/test.dart';
-
import 'package:vector_math/vector_math.dart';
import 'test_utils.dart';
@@ -77,11 +76,11 @@
}
void testQuaternionConjugate() {
- List<Quaternion> input = List<Quaternion>();
+ List<Quaternion> input = <Quaternion>[];
input.add(Quaternion.identity());
input.add(Quaternion(0.18260, 0.54770, 0.73030, 0.36510));
input.add(Quaternion(0.9889, 0.0, 0.0, 0.14834));
- List<Quaternion> expectedOutput = List<Quaternion>();
+ List<Quaternion> expectedOutput = <Quaternion>[];
expectedOutput.add(Quaternion(-0.0, -0.0, -0.0, 1.0));
expectedOutput.add(Quaternion(-0.18260, -0.54770, -0.73030, 0.36510));
expectedOutput.add(Quaternion(-0.9889, -0.0, -0.0, 0.1483));
@@ -89,7 +88,7 @@
}
void testQuaternionMatrixQuaternionRoundTrip() {
- List<Quaternion> input = List<Quaternion>();
+ List<Quaternion> input = <Quaternion>[];
input.add(Quaternion.identity()..normalize());
input.add(Quaternion(0.18260, 0.54770, 0.73030, 0.36510)..normalize());
input.add(Quaternion(0.9889, 0.0, 0.0, 0.14834)..normalize());
@@ -101,22 +100,22 @@
}
void testQuaternionMultiplying() {
- List<Quaternion> inputA = List<Quaternion>();
+ List<Quaternion> inputA = <Quaternion>[];
inputA.add(Quaternion(0.18260, 0.54770, 0.73030, 0.36510));
inputA.add(Quaternion(0.9889, 0.0, 0.0, 0.14834));
- List<Quaternion> inputB = List<Quaternion>();
+ List<Quaternion> inputB = <Quaternion>[];
inputB.add(Quaternion(0.9889, 0.0, 0.0, 0.14834));
inputB.add(Quaternion(0.18260, 0.54770, 0.73030, 0.36510));
- List<Quaternion> expectedOutput = List<Quaternion>();
+ List<Quaternion> expectedOutput = <Quaternion>[];
expectedOutput.add(Quaternion(0.388127, 0.803418, -0.433317, -0.126429));
expectedOutput.add(Quaternion(0.388127, -0.64097, 0.649924, -0.126429));
testQuaternionMultiply(inputA, inputB, expectedOutput);
}
void testQuaternionNormalize() {
- List<Quaternion> inputA = List<Quaternion>();
- List<Vector3> inputB = List<Vector3>();
- List<Vector3> expectedOutput = List<Vector3>();
+ List<Quaternion> inputA = <Quaternion>[];
+ List<Vector3> inputB = <Vector3>[];
+ List<Vector3> expectedOutput = <Vector3>[];
inputA.add(Quaternion(0.0, 1.0, 0.0, 1.0)..normalize());
inputB.add(Vector3(1.0, 1.0, 1.0));
diff --git a/test/test_all.dart b/test/test_all.dart
index efa77b9..46443cf 100644
--- a/test/test_all.dart
+++ b/test/test_all.dart
@@ -19,15 +19,15 @@
import 'quad_test.dart' as quad;
import 'quaternion_test.dart' as quaternion;
import 'ray_test.dart' as ray;
+import 'scalar_list_view_test.dart' as scalar_list_view;
import 'sphere_test.dart' as sphere;
import 'triangle_test.dart' as triangle;
import 'utilities_test.dart' as utilities;
-import 'scalar_list_view_test.dart' as scalar_list_view;
import 'vector2_list_test.dart' as vector2_list;
-import 'vector3_list_test.dart' as vector3_list;
-import 'vector4_list_test.dart' as vector4_list;
import 'vector2_test.dart' as vector2;
+import 'vector3_list_test.dart' as vector3_list;
import 'vector3_test.dart' as vector3;
+import 'vector4_list_test.dart' as vector4_list;
import 'vector4_test.dart' as vector4;
void main() {
diff --git a/test/test_utils.dart b/test/test_utils.dart
index 11fb95b..904360a 100644
--- a/test/test_utils.dart
+++ b/test/test_utils.dart
@@ -49,7 +49,7 @@
T parseMatrix<T>(String input) {
input = input.trim();
List<String> rows = input.split("\n");
- List<double> values = List<double>();
+ List<double> values = <double>[];
int col_count = 0;
for (int i = 0; i < rows.length; i++) {
rows[i] = rows[i].trim();
@@ -84,7 +84,7 @@
v = v.trim();
Pattern pattern = RegExp('[\\s]+', multiLine: true, caseSensitive: false);
List<String> rows = v.split(pattern);
- List<double> values = List<double>();
+ List<double> values = <double>[];
for (int i = 0; i < rows.length; i++) {
rows[i] = rows[i].trim();
if (rows[i].isEmpty) {
diff --git a/test/vector2_test.dart b/test/vector2_test.dart
index 6bb9775..c5bfc0f 100644
--- a/test/vector2_test.dart
+++ b/test/vector2_test.dart
@@ -4,12 +4,10 @@
library vector_math.test.vector2_test;
+import 'dart:math' as math;
import 'dart:typed_data';
-import 'dart:math' as math;
-
import 'package:test/test.dart';
-
import 'package:vector_math/vector_math.dart';
import 'test_utils.dart';
diff --git a/test/vector3_test.dart b/test/vector3_test.dart
index 67fae48..135324f 100644
--- a/test/vector3_test.dart
+++ b/test/vector3_test.dart
@@ -4,11 +4,10 @@
library vector_math.test.vector3_test;
-import 'dart:typed_data';
import 'dart:math' as math;
+import 'dart:typed_data';
import 'package:test/test.dart';
-
import 'package:vector_math/vector_math.dart';
import 'test_utils.dart';
@@ -93,9 +92,9 @@
}
void testVector3DotProduct() {
- List<Vector3> inputA = List<Vector3>();
- List<Vector3> inputB = List<Vector3>();
- List<double> expectedOutput = List<double>();
+ List<Vector3> inputA = <Vector3>[];
+ List<Vector3> inputB = <Vector3>[];
+ List<double> expectedOutput = <double>[];
inputA.add(parseVector<Vector3>('''0.417267069084370
0.049654430325742
0.902716109915281'''));
@@ -132,9 +131,9 @@
}
void testVector3CrossProduct() {
- List<Vector3> inputA = List<Vector3>();
- List<Vector3> inputB = List<Vector3>();
- List<Vector3> expectedOutput = List<Vector3>();
+ List<Vector3> inputA = <Vector3>[];
+ List<Vector3> inputB = <Vector3>[];
+ List<Vector3> expectedOutput = <Vector3>[];
inputA.add(parseVector<Vector3>('''0.417267069084370
0.049654430325742
diff --git a/test/vector4_test.dart b/test/vector4_test.dart
index c7016a9..5762bbc 100644
--- a/test/vector4_test.dart
+++ b/test/vector4_test.dart
@@ -4,12 +4,10 @@
library vector_math.test.vector4_test;
+import 'dart:math' as math;
import 'dart:typed_data';
-import 'dart:math' as math;
-
import 'package:test/test.dart';
-
import 'package:vector_math/vector_math.dart';
import 'test_utils.dart';