From 19bb3bbe02bcc385fea1433340e4c4350f644806 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Jun 2026 14:31:14 -0400 Subject: [PATCH 1/4] Re-sync options file --- analysis_options.yaml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index ac92509..dfc3bd2 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,7 +1,7 @@ # Specify analysis options. # # This file is a copy of analysis_options.yaml from flutter/packages -# as of 2026-05-20. The file is expected to be kept in sync with the +# as of 2026-06-03. The file is expected to be kept in sync with the # flutter/packages copy (which is in turn mostly synchronized with # flutter/flutter). @@ -24,20 +24,24 @@ analyzer: - '**/*.ffi.dart' - '**/*.mocks.dart' # Mockito @GenerateMocks +formatter: + page_width: 100 + linter: rules: # This list is derived from the list of all available lints located at - # https://github.com/dart-lang/linter/blob/main/example/all.yaml + # https://github.com/dart-lang/sdk/blob/main/pkg/linter/example/all.yaml - always_declare_return_types - always_put_control_body_on_new_line # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 # - always_specify_types # conflicts with omit_obvious_local_variable_types # - always_use_package_imports # we do this commonly - annotate_overrides - # - avoid_annotating_with_dynamic # conflicts with always_specify_types + - annotate_redeclares + # - avoid_annotating_with_dynamic # conflicts with type_annotate_public_apis - avoid_bool_literals_in_conditional_expressions # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023 - # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023 + # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/4998 # - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es - avoid_double_and_int_checks - avoid_dynamic_calls @@ -45,12 +49,15 @@ linter: - avoid_equals_and_hash_code_on_mutable_classes - avoid_escaping_inner_quotes - avoid_field_initializers_in_const_classes - # - avoid_final_parameters # incompatible with prefer_final_parameters + # TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13. + - avoid_final_parameters - avoid_function_literals_in_foreach_calls + # - avoid_futureor_void # not yet tested # - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558 - avoid_init_to_null - avoid_js_rounded_ints # - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to + - avoid_null_checks_in_equality_operators # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it - avoid_print # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) @@ -66,7 +73,7 @@ linter: - avoid_slow_async_io - avoid_type_to_string - avoid_types_as_parameter_names - # - avoid_types_on_closure_parameters # conflicts with always_specify_types + # - avoid_types_on_closure_parameters # not yet tested - avoid_unnecessary_containers - avoid_unused_constructor_parameters - avoid_void_async @@ -93,6 +100,7 @@ linter: - directives_ordering # - discarded_futures # too many false positives, similar to unawaited_futures # - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic + # - document_ignores # not yet tested - empty_catches - empty_constructor_bodies - empty_statements @@ -105,6 +113,7 @@ linter: - implicit_call_tearoffs - implicit_reopen - invalid_case_patterns + # - invalid_runtime_check_with_js_interop_types # DIFFERENT FROM FLUTTER/FLUTTER temporarily disabled due to https://github.com/flutter/flutter/issues/187454 # - join_return_with_assignment # not required by flutter style - leading_newlines_in_multiline_strings - library_annotations @@ -116,7 +125,7 @@ linter: # - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509 - missing_code_block_language_in_doc_comment - missing_whitespace_between_adjacent_strings - # - no_adjacent_strings_in_list # conflicts with prefer_adjacent_string_concatenation + - no_adjacent_strings_in_list - no_default_cases - no_duplicate_case_values - no_leading_underscores_for_library_prefixes @@ -130,12 +139,12 @@ linter: - noop_primitive_operations - null_check_on_nullable_type_parameter - null_closures - # - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types + # - omit_local_variable_types # superset of omit_obvious_local_variable_types - omit_obvious_local_variable_types + # - omit_obvious_property_types # conflicts with type_annotate_public_apis # - one_member_abstracts # too many false positives - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al - overridden_fields - # - package_api_docs # Deprecated (https://github.com/dart-lang/linter/issues/5107) - package_names - package_prefixed_library_names # - parameter_assignments # we do this commonly @@ -192,6 +201,7 @@ linter: - sort_unnamed_constructors_first - specify_nonobvious_local_variable_types - specify_nonobvious_property_types + - strict_top_level_inference - test_types_in_equals - throw_in_finally - tighten_type_of_initializing_formals @@ -207,9 +217,11 @@ linter: - unnecessary_constructor_name # - unnecessary_final # conflicts with prefer_final_locals - unnecessary_getters_setters + # - unnecessary_ignore # Disabled by default to simplify migrations; should be periodically enabled locally to clean up offenders # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - unnecessary_late - unnecessary_library_directive + # - unnecessary_library_name # blocked on https://github.com/dart-lang/dartdoc/issues/3882 - unnecessary_new - unnecessary_null_aware_assignments - unnecessary_null_aware_operator_on_extension_on_nullable @@ -224,8 +236,10 @@ linter: - unnecessary_string_interpolations - unnecessary_this - unnecessary_to_list_in_spreads + - unnecessary_underscores - unreachable_from_main - unrelated_type_equality_checks + # - unsafe_variance # not yet tested - use_build_context_synchronously - use_colored_box # - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding) @@ -245,5 +259,8 @@ linter: - use_super_parameters - use_test_throws_matchers # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review + - use_truncating_division - valid_regexps + # TODO(kallentu): Remove this lint once the Dart SDK in Flutter is on version 3.13. + - var_with_no_type_annotation - void_checks From 9c06a3172414dfa824d859f3f99deb8562b5a7fb Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Jun 2026 14:34:54 -0400 Subject: [PATCH 2/4] Autoformat --- .../benchmark/matrix4_tween_bench.dart | 15 +- .../vector_math/benchmark/matrix_bench.dart | 27 +- .../lib/src/vector_math/aabb2.dart | 26 +- .../lib/src/vector_math/aabb3.dart | 85 +- .../lib/src/vector_math/colors.dart | 222 ++--- .../lib/src/vector_math/matrix2.dart | 18 +- .../lib/src/vector_math/matrix3.dart | 120 +-- .../lib/src/vector_math/matrix4.dart | 280 ++---- .../vector_math/lib/src/vector_math/obb3.dart | 77 +- .../lib/src/vector_math/opengl.dart | 64 +- .../lib/src/vector_math/plane.dart | 10 +- .../lib/src/vector_math/quaternion.dart | 12 +- .../lib/src/vector_math/sphere.dart | 13 +- .../lib/src/vector_math/triangle.dart | 5 +- .../lib/src/vector_math/utilities.dart | 11 +- .../lib/src/vector_math/vector.dart | 6 +- .../lib/src/vector_math/vector2.dart | 54 +- .../lib/src/vector_math/vector3.dart | 316 +++---- .../lib/src/vector_math/vector4.dart | 810 ++++++------------ .../lib/src/vector_math_64/aabb2.dart | 26 +- .../lib/src/vector_math_64/aabb3.dart | 85 +- .../lib/src/vector_math_64/colors.dart | 222 ++--- .../lib/src/vector_math_64/matrix2.dart | 18 +- .../lib/src/vector_math_64/matrix3.dart | 120 +-- .../lib/src/vector_math_64/matrix4.dart | 280 ++---- .../lib/src/vector_math_64/obb3.dart | 77 +- .../lib/src/vector_math_64/opengl.dart | 64 +- .../lib/src/vector_math_64/plane.dart | 10 +- .../lib/src/vector_math_64/quaternion.dart | 12 +- .../lib/src/vector_math_64/sphere.dart | 13 +- .../lib/src/vector_math_64/triangle.dart | 5 +- .../lib/src/vector_math_64/utilities.dart | 11 +- .../lib/src/vector_math_64/vector.dart | 6 +- .../lib/src/vector_math_64/vector2.dart | 54 +- .../lib/src/vector_math_64/vector3.dart | 316 +++---- .../lib/src/vector_math_64/vector4.dart | 810 ++++++------------ .../filters/barycentric_filter.dart | 4 +- .../filters/color_filter.dart | 9 +- .../filters/flat_shade_filter.dart | 16 +- .../filters/transform_filter.dart | 4 +- .../generators/attribute_generators.dart | 14 +- .../generators/circle_generator.dart | 6 +- .../generators/cube_generator.dart | 6 +- .../generators/cylinder_generator.dart | 16 +- .../generators/geometry_generator.dart | 26 +- .../generators/ring_generator.dart | 6 +- .../generators/sphere_generator.dart | 12 +- .../vector_math_geometry/mesh_geometry.dart | 85 +- .../vector_math_lists/scalar_list_view.dart | 4 +- .../src/vector_math_lists/vector2_list.dart | 3 +- .../src/vector_math_lists/vector3_list.dart | 3 +- .../src/vector_math_lists/vector4_list.dart | 3 +- .../src/vector_math_lists/vector_list.dart | 48 +- .../src/vector_math_operations/matrix.dart | 23 +- packages/vector_math/test/aabb3_test.dart | 79 +- packages/vector_math/test/colors_test.dart | 5 +- packages/vector_math/test/frustum_test.dart | 170 +--- packages/vector_math/test/geometry_test.dart | 12 +- packages/vector_math/test/matrix3_test.dart | 37 +- packages/vector_math/test/matrix4_test.dart | 187 ++-- packages/vector_math/test/obb3_test.dart | 42 +- .../vector_math/test/opengl_matrix_test.dart | 23 +- packages/vector_math/test/quad_test.dart | 5 +- .../vector_math/test/quaternion_test.dart | 30 +- packages/vector_math/test/ray_test.dart | 24 +- packages/vector_math/test/test_utils.dart | 6 +- .../vector_math/test/vector3_list_test.dart | 30 +- packages/vector_math/test/vector3_test.dart | 45 +- .../vector_math/test/vector4_list_test.dart | 24 +- packages/vector_math/test/vector4_test.dart | 19 +- .../tool/generate_vector_math_64.dart | 14 +- 71 files changed, 1505 insertions(+), 3835 deletions(-) diff --git a/packages/vector_math/benchmark/matrix4_tween_bench.dart b/packages/vector_math/benchmark/matrix4_tween_bench.dart index 756147b..a47adb8 100644 --- a/packages/vector_math/benchmark/matrix4_tween_bench.dart +++ b/packages/vector_math/benchmark/matrix4_tween_bench.dart @@ -49,10 +49,9 @@ class Matrix4TweenBenchmark1 extends BenchmarkBase with Setup { final endScale = Vector3.zero(); begin.decompose(beginTranslation, beginRotation, beginScale); end.decompose(endTranslation, endRotation, endScale); - final Vector3 lerpTranslation = - beginTranslation * (1.0 - t) + endTranslation * t; - final Quaternion lerpRotation = - (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)).normalized(); + final Vector3 lerpTranslation = beginTranslation * (1.0 - t) + endTranslation * t; + final Quaternion lerpRotation = (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)) + .normalized(); final Vector3 lerpScale = beginScale * (1.0 - t) + endScale * t; return Matrix4.compose(lerpTranslation, lerpRotation, lerpScale); } @@ -66,8 +65,8 @@ class Matrix4TweenBenchmark2 extends BenchmarkBase with Setup { begin.decompose(beginTranslation, beginRotation, beginScale); end.decompose(endTranslation, endRotation, endScale); Vector3.mix(beginTranslation, endTranslation, t, lerpTranslation); - final Quaternion lerpRotation = - (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)).normalized(); + final Quaternion lerpRotation = (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)) + .normalized(); Vector3.mix(beginScale, endScale, t, lerpScale); return Matrix4.compose(lerpTranslation, lerpRotation, lerpScale); } @@ -91,8 +90,8 @@ class Matrix4TweenBenchmark3 extends BenchmarkBase with Setup { begin.decompose(beginTranslation, beginRotation, beginScale); end.decompose(endTranslation, endRotation, endScale); Vector3.mix(beginTranslation, endTranslation, t, lerpTranslation); - final Quaternion lerpRotation = - (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)).normalized(); + final Quaternion lerpRotation = (beginRotation.scaled(1.0 - t) + endRotation.scaled(t)) + .normalized(); Vector3.mix(beginScale, endScale, t, lerpScale); return Matrix4.compose(lerpTranslation, lerpRotation, lerpScale); } diff --git a/packages/vector_math/benchmark/matrix_bench.dart b/packages/vector_math/benchmark/matrix_bench.dart index 5015db5..8501a25 100644 --- a/packages/vector_math/benchmark/matrix_bench.dart +++ b/packages/vector_math/benchmark/matrix_bench.dart @@ -322,8 +322,7 @@ class Matrix3TransposeMultiplyBenchmark extends BenchmarkBase { } class Matrix4TranslateByDoubleGenericBenchmark extends BenchmarkBase { - Matrix4TranslateByDoubleGenericBenchmark() - : super('Matrix4.translateByDoubleGeneric'); + Matrix4TranslateByDoubleGenericBenchmark() : super('Matrix4.translateByDoubleGeneric'); final temp = Matrix4.zero()..setIdentity(); @@ -340,8 +339,7 @@ class Matrix4TranslateByDoubleGenericBenchmark extends BenchmarkBase { } class Matrix4TranslateByVector3GenericBenchmark extends BenchmarkBase { - Matrix4TranslateByVector3GenericBenchmark() - : super('Matrix4.translateByVector3Generic'); + Matrix4TranslateByVector3GenericBenchmark() : super('Matrix4.translateByVector3Generic'); final temp = Matrix4.zero()..setIdentity(); final vec = Vector3(10.0, 20.0, 30.0); @@ -359,8 +357,7 @@ class Matrix4TranslateByVector3GenericBenchmark extends BenchmarkBase { } class Matrix4TranslateByVector4GenericBenchmark extends BenchmarkBase { - Matrix4TranslateByVector4GenericBenchmark() - : super('Matrix4.translateByVector4Generic'); + Matrix4TranslateByVector4GenericBenchmark() : super('Matrix4.translateByVector4Generic'); final temp = Matrix4.zero()..setIdentity(); final vec = Vector4(10.0, 20.0, 30.0, 40.0); @@ -392,12 +389,7 @@ class Matrix4TranslateByDoubleBenchmark extends BenchmarkBase { @override void setup() { for (var i = 0; i < 10; i++) { - temp.translateByDouble( - i.toDouble(), - (i * 10).toDouble(), - (i * 5).toDouble(), - 1.0, - ); + temp.translateByDouble(i.toDouble(), (i * 10).toDouble(), (i * 5).toDouble(), 1.0); } } @@ -425,9 +417,7 @@ class Matrix4TranslateByVector3Benchmark extends BenchmarkBase { @override void setup() { for (var i = 0; i < 10; i++) { - temp.translateByVector3( - Vector3(i.toDouble(), (i * 10).toDouble(), (i * 5).toDouble()), - ); + temp.translateByVector3(Vector3(i.toDouble(), (i * 10).toDouble(), (i * 5).toDouble())); } } @@ -456,12 +446,7 @@ class Matrix4TranslateByVector4Benchmark extends BenchmarkBase { void setup() { for (var i = 0; i < 10; i++) { temp.translateByVector4( - Vector4( - i.toDouble(), - (i * 10).toDouble(), - (i * 5).toDouble(), - (i * 20).toDouble(), - ), + Vector4(i.toDouble(), (i * 10).toDouble(), (i * 5).toDouble(), (i * 20).toDouble()), ); } } diff --git a/packages/vector_math/lib/src/vector_math/aabb2.dart b/packages/vector_math/lib/src/vector_math/aabb2.dart index 9d29f2f..4249e70 100644 --- a/packages/vector_math/lib/src/vector_math/aabb2.dart +++ b/packages/vector_math/lib/src/vector_math/aabb2.dart @@ -11,14 +11,10 @@ class Aabb2 { Aabb2() : _min = Vector2.zero(), _max = Vector2.zero(); /// Create a new AABB as a copy of [other]. - Aabb2.copy(Aabb2 other) - : _min = Vector2.copy(other._min), - _max = Vector2.copy(other._max); + Aabb2.copy(Aabb2 other) : _min = Vector2.copy(other._min), _max = Vector2.copy(other._max); /// Create a new AABB with a [min] and [max]. - Aabb2.minMax(Vector2 min, Vector2 max) - : _min = Vector2.copy(min), - _max = Vector2.copy(max); + Aabb2.minMax(Vector2 min, Vector2 max) : _min = Vector2.copy(min), _max = Vector2.copy(max); /// Create a new AABB with a [center] and [halfExtents]. factory Aabb2.centerAndHalfExtents(Vector2 center, Vector2 halfExtents) => @@ -29,10 +25,7 @@ class Aabb2 { /// [Float32List.bytesPerElement]. Aabb2.fromBuffer(ByteBuffer buffer, int offset) : _min = Vector2.fromBuffer(buffer, offset), - _max = Vector2.fromBuffer( - buffer, - offset + Float32List.bytesPerElement * 2, - ); + _max = Vector2.fromBuffer(buffer, offset + Float32List.bytesPerElement * 2); final Vector2 _min; final Vector2 _max; @@ -77,8 +70,7 @@ class Aabb2 { static final _center = Vector2.zero(); static final _halfExtents = Vector2.zero(); - void _updateCenterAndHalfExtents() => - copyCenterAndHalfExtents(_center, _halfExtents); + void _updateCenterAndHalfExtents() => copyCenterAndHalfExtents(_center, _halfExtents); /// Transform this by the transform [t]. void transform(Matrix3 t) { @@ -144,10 +136,7 @@ class Aabb2 { /// Return if this contains [other]. bool containsVector2(Vector2 other) => - (_min.x < other.x) && - (_min.y < other.y) && - (_max.x > other.x) && - (_max.y > other.y); + (_min.x < other.x) && (_min.y < other.y) && (_max.x > other.x) && (_max.y > other.y); /// Return if this intersects with [other]. bool intersectsWithAabb2(Aabb2 other) { @@ -162,8 +151,5 @@ class Aabb2 { /// Return if this intersects with [other]. bool intersectsWithVector2(Vector2 other) => - (_min.x <= other.x) && - (_min.y <= other.y) && - (_max.x >= other.x) && - (_max.y >= other.y); + (_min.x <= other.x) && (_min.y <= other.y) && (_max.x >= other.x) && (_max.y >= other.y); } diff --git a/packages/vector_math/lib/src/vector_math/aabb3.dart b/packages/vector_math/lib/src/vector_math/aabb3.dart index 473fd58..4d02ae8 100644 --- a/packages/vector_math/lib/src/vector_math/aabb3.dart +++ b/packages/vector_math/lib/src/vector_math/aabb3.dart @@ -15,21 +15,16 @@ class Aabb3 { Aabb3() : _min = Vector3.zero(), _max = Vector3.zero(); /// Create a new AABB as a copy of [other]. - Aabb3.copy(Aabb3 other) - : _min = Vector3.copy(other._min), - _max = Vector3.copy(other._max); + Aabb3.copy(Aabb3 other) : _min = Vector3.copy(other._min), _max = Vector3.copy(other._max); /// Create a new AABB with a [min] and [max]. - Aabb3.minMax(Vector3 min, Vector3 max) - : _min = Vector3.copy(min), - _max = Vector3.copy(max); + Aabb3.minMax(Vector3 min, Vector3 max) : _min = Vector3.copy(min), _max = Vector3.copy(max); /// Create a new AABB that encloses a [sphere]. factory Aabb3.fromSphere(Sphere sphere) => Aabb3()..setSphere(sphere); /// Create a new AABB that encloses a [triangle]. - factory Aabb3.fromTriangle(Triangle triangle) => - Aabb3()..setTriangle(triangle); + factory Aabb3.fromTriangle(Triangle triangle) => Aabb3()..setTriangle(triangle); /// Create a new AABB that encloses a [quad]. factory Aabb3.fromQuad(Quad quad) => Aabb3()..setQuad(quad); @@ -51,10 +46,7 @@ class Aabb3 { /// [Float32List.bytesPerElement]. Aabb3.fromBuffer(ByteBuffer buffer, int offset) : _min = Vector3.fromBuffer(buffer, offset), - _max = Vector3.fromBuffer( - buffer, - offset + Float32List.bytesPerElement * 3, - ); + _max = Vector3.fromBuffer(buffer, offset + Float32List.bytesPerElement * 3); final Vector3 _min; final Vector3 _max; @@ -89,64 +81,28 @@ class Aabb3 { /// Set the AABB to enclose a [triangle]. void setTriangle(Triangle triangle) { _min.setValues( - math.min( - triangle._point0.x, - math.min(triangle._point1.x, triangle._point2.x), - ), - math.min( - triangle._point0.y, - math.min(triangle._point1.y, triangle._point2.y), - ), - math.min( - triangle._point0.z, - math.min(triangle._point1.z, triangle._point2.z), - ), + math.min(triangle._point0.x, math.min(triangle._point1.x, triangle._point2.x)), + math.min(triangle._point0.y, math.min(triangle._point1.y, triangle._point2.y)), + math.min(triangle._point0.z, math.min(triangle._point1.z, triangle._point2.z)), ); _max.setValues( - math.max( - triangle._point0.x, - math.max(triangle._point1.x, triangle._point2.x), - ), - math.max( - triangle._point0.y, - math.max(triangle._point1.y, triangle._point2.y), - ), - math.max( - triangle._point0.z, - math.max(triangle._point1.z, triangle._point2.z), - ), + math.max(triangle._point0.x, math.max(triangle._point1.x, triangle._point2.x)), + math.max(triangle._point0.y, math.max(triangle._point1.y, triangle._point2.y)), + math.max(triangle._point0.z, math.max(triangle._point1.z, triangle._point2.z)), ); } /// Set the AABB to enclose a [quad]. void setQuad(Quad quad) { _min.setValues( - math.min( - quad._point0.x, - math.min(quad._point1.x, math.min(quad._point2.x, quad._point3.x)), - ), - math.min( - quad._point0.y, - math.min(quad._point1.y, math.min(quad._point2.y, quad._point3.y)), - ), - math.min( - quad._point0.z, - math.min(quad._point1.z, math.min(quad._point2.z, quad._point3.z)), - ), + math.min(quad._point0.x, math.min(quad._point1.x, math.min(quad._point2.x, quad._point3.x))), + math.min(quad._point0.y, math.min(quad._point1.y, math.min(quad._point2.y, quad._point3.y))), + math.min(quad._point0.z, math.min(quad._point1.z, math.min(quad._point2.z, quad._point3.z))), ); _max.setValues( - math.max( - quad._point0.x, - math.max(quad._point1.x, math.max(quad._point2.x, quad._point3.x)), - ), - math.max( - quad._point0.y, - math.max(quad._point1.y, math.max(quad._point2.y, quad._point3.y)), - ), - math.max( - quad._point0.z, - math.max(quad._point1.z, math.max(quad._point2.z, quad._point3.z)), - ), + math.max(quad._point0.x, math.max(quad._point1.x, math.max(quad._point2.x, quad._point3.x))), + math.max(quad._point0.y, math.max(quad._point1.y, math.max(quad._point2.y, quad._point3.y))), + math.max(quad._point0.z, math.max(quad._point1.z, math.max(quad._point2.z, quad._point3.z))), ); } @@ -234,8 +190,7 @@ class Aabb3 { static final _center = Vector3.zero(); static final _halfExtents = Vector3.zero(); - void _updateCenterAndHalfExtents() => - copyCenterAndHalfExtents(_center, _halfExtents); + void _updateCenterAndHalfExtents() => copyCenterAndHalfExtents(_center, _halfExtents); /// Transform this by the transform [t]. void transform(Matrix4 t) { @@ -420,11 +375,7 @@ class Aabb3 { /// be used for the test. If [result] is specified and an intersection is /// found, result is modified to contain more details about the type of /// intersection. - bool intersectsWithTriangle( - Triangle other, { - double epsilon = 1e-3, - IntersectionResult? result, - }) { + bool intersectsWithTriangle(Triangle other, {double epsilon = 1e-3, IntersectionResult? result}) { double p0, p1, p2, r, len; double a; diff --git a/packages/vector_math/lib/src/vector_math/colors.dart b/packages/vector_math/lib/src/vector_math/colors.dart index 575b4e5..f61440d 100644 --- a/packages/vector_math/lib/src/vector_math/colors.dart +++ b/packages/vector_math/lib/src/vector_math/colors.dart @@ -78,11 +78,7 @@ class Colors { /// the alpha channel, set [alpha] to true, it is false by default. If [short] /// is true, the resulting hex string might also be a short version, like #ff0 /// (default false). - static String toHexString( - Vector4 input, { - bool alpha = false, - bool short = false, - }) { + static String toHexString(Vector4 input, {bool alpha = false, bool short = false}) { final int r = (input.r * 0xFF).floor() & 0xFF; final int g = (input.g * 0xFF).floor() & 0xFF; final int b = (input.b * 0xFF).floor() & 0xFF; @@ -97,9 +93,7 @@ class Colors { if (isShort) { final String rgb = - (r & 0xF).toRadixString(16) + - (g & 0xF).toRadixString(16) + - (b & 0xF).toRadixString(16); + (r & 0xF).toRadixString(16) + (g & 0xF).toRadixString(16) + (b & 0xF).toRadixString(16); return alpha ? (a & 0xF).toRadixString(16) + rgb : rgb; } else { @@ -114,26 +108,16 @@ class Colors { /// Blend the [foreground] color over [background] color and store the color /// in [result]. - static void alphaBlend( - Vector4 foreground, - Vector4 background, - Vector4 result, - ) { + static void alphaBlend(Vector4 foreground, Vector4 background, Vector4 result) { final double a = foreground.a + (1.0 - foreground.a) * background.a; final double factor = 1.0 / a; final double r = - factor * - (foreground.a * foreground.r + - (1.0 - foreground.a) * background.a * background.r); + factor * (foreground.a * foreground.r + (1.0 - foreground.a) * background.a * background.r); final double g = - factor * - (foreground.a * foreground.g + - (1.0 - foreground.a) * background.a * background.g); + factor * (foreground.a * foreground.g + (1.0 - foreground.a) * background.a * background.g); final double b = - factor * - (foreground.a * foreground.b + - (1.0 - foreground.a) * background.a * background.b); + factor * (foreground.a * foreground.b + (1.0 - foreground.a) * background.a * background.b); result.setValues(r, g, b, a); } @@ -152,11 +136,7 @@ class Colors { /// Convert [linearColor] from linear space into gamma color space and store /// the result in [gammaColor]. It is possible to specify a optional [gamma], /// the default value is 2.2. - static void linearToGamma( - Vector4 linearColor, - Vector4 gammaColor, [ - double gamma = 2.2, - ]) { + static void linearToGamma(Vector4 linearColor, Vector4 gammaColor, [double gamma = 2.2]) { final double exponent = 1.0 / gamma; gammaColor @@ -169,11 +149,7 @@ class Colors { /// Convert [gammaColor] from gamma space into linear color space and store /// the result in [linearColor]. It is possible to specify a optional [gamma], /// the default value is 2.2. - static void gammaToLinear( - Vector4 gammaColor, - Vector4 linearColor, [ - double gamma = 2.2, - ]) { + static void gammaToLinear(Vector4 gammaColor, Vector4 linearColor, [double gamma = 2.2]) { linearColor ..r = math.pow(gammaColor.r, gamma).toDouble() ..g = math.pow(gammaColor.g, gamma).toDouble() @@ -193,9 +169,7 @@ class Colors { if (max != min) { if (max == rgbColor.r) { - h = - (rgbColor.g - rgbColor.b) / d + - (rgbColor.g < rgbColor.b ? 6.0 : 0.0); + h = (rgbColor.g - rgbColor.b) / d + (rgbColor.g < rgbColor.b ? 6.0 : 0.0); } else if (max == rgbColor.g) { h = (rgbColor.b - rgbColor.r) / d + 2.0; } else { @@ -248,9 +222,7 @@ class Colors { s = l > 0.5 ? d / (2.0 - max - min) : d / (max + min); if (max == rgbColor.r) { - h = - (rgbColor.g - rgbColor.b) / d + - (rgbColor.g < rgbColor.b ? 6.0 : 0.0); + h = (rgbColor.g - rgbColor.b) / d + (rgbColor.g < rgbColor.b ? 6.0 : 0.0); } else if (max == rgbColor.g) { h = (rgbColor.b - rgbColor.r) / d + 2.0; } else { @@ -313,44 +285,37 @@ class Colors { Vector4(250.0 / 255.0, 235.0 / 255.0, 215.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'aqua'. - static Vector4 get aqua => - Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get aqua => Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'aquamarine'. static Vector4 get aquamarine => Vector4(127.0 / 255.0, 255.0 / 255.0, 212.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'azure'. - static Vector4 get azure => - Vector4(240.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get azure => Vector4(240.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'beige'. - static Vector4 get beige => - Vector4(245.0 / 255.0, 245.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); + static Vector4 get beige => Vector4(245.0 / 255.0, 245.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'bisque'. - static Vector4 get bisque => - Vector4(255.0 / 255.0, 228.0 / 255.0, 196.0 / 255.0, 255.0 / 255.0); + static Vector4 get bisque => Vector4(255.0 / 255.0, 228.0 / 255.0, 196.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'black'. - static Vector4 get black => - Vector4(0.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get black => Vector4(0.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blanchedalmond'. static Vector4 get blanchedAlmond => Vector4(255.0 / 255.0, 235.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blue'. - static Vector4 get blue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get blue => Vector4(0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blueviolet'. static Vector4 get blueViolet => Vector4(138.0 / 255.0, 43.0 / 255.0, 226.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'brown'. - static Vector4 get brown => - Vector4(165.0 / 255.0, 42.0 / 255.0, 42.0 / 255.0, 255.0 / 255.0); + static Vector4 get brown => Vector4(165.0 / 255.0, 42.0 / 255.0, 42.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'burlywood'. static Vector4 get burlyWood => @@ -369,8 +334,7 @@ class Colors { Vector4(210.0 / 255.0, 105.0 / 255.0, 30.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'coral'. - static Vector4 get coral => - Vector4(255.0 / 255.0, 127.0 / 255.0, 80.0 / 255.0, 255.0 / 255.0); + static Vector4 get coral => Vector4(255.0 / 255.0, 127.0 / 255.0, 80.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'cornflowerblue'. static Vector4 get cornflowerBlue => @@ -381,20 +345,16 @@ class Colors { Vector4(255.0 / 255.0, 248.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'crimson'. - static Vector4 get crimson => - Vector4(220.0 / 255.0, 20.0 / 255.0, 60.0 / 255.0, 255.0 / 255.0); + static Vector4 get crimson => Vector4(220.0 / 255.0, 20.0 / 255.0, 60.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'cyan'. - static Vector4 get cyan => - Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get cyan => Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkblue'. - static Vector4 get darkBlue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkBlue => Vector4(0.0 / 255.0, 0.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkcyan'. - static Vector4 get darkCyan => - Vector4(0.0 / 255.0, 139.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkCyan => Vector4(0.0 / 255.0, 139.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkgoldenrod'. static Vector4 get darkGoldenrod => @@ -405,8 +365,7 @@ class Colors { Vector4(169.0 / 255.0, 169.0 / 255.0, 169.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkgreen'. - static Vector4 get darkGreen => - Vector4(0.0 / 255.0, 100.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkGreen => Vector4(0.0 / 255.0, 100.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkkhaki'. static Vector4 get darkKhaki => @@ -429,8 +388,7 @@ class Colors { Vector4(153.0 / 255.0, 50.0 / 255.0, 204.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkred'. - static Vector4 get darkRed => - Vector4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkRed => Vector4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darksalmon'. static Vector4 get darkSalmon => @@ -457,24 +415,21 @@ class Colors { Vector4(148.0 / 255.0, 0.0 / 255.0, 211.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'deeppink'. - static Vector4 get deepPink => - Vector4(255.0 / 255.0, 20.0 / 255.0, 147.0 / 255.0, 255.0 / 255.0); + static Vector4 get deepPink => Vector4(255.0 / 255.0, 20.0 / 255.0, 147.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'deepskyblue'. static Vector4 get deepSkyBlue => Vector4(0.0 / 255.0, 191.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'dimgray'. - static Vector4 get dimGray => - Vector4(105.0 / 255.0, 105.0 / 255.0, 105.0 / 255.0, 255.0 / 255.0); + static Vector4 get dimGray => Vector4(105.0 / 255.0, 105.0 / 255.0, 105.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'dodgerblue'. static Vector4 get dodgerBlue => Vector4(30.0 / 255.0, 144.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'firebrick'. - static Vector4 get firebrick => - Vector4(178.0 / 255.0, 34.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); + static Vector4 get firebrick => Vector4(178.0 / 255.0, 34.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'floralwhite'. static Vector4 get floralWhite => @@ -485,8 +440,7 @@ class Colors { Vector4(34.0 / 255.0, 139.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'fuchsia'. - static Vector4 get fuchsia => - Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get fuchsia => Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gainsboro'. static Vector4 get gainsboro => @@ -497,20 +451,17 @@ class Colors { Vector4(248.0 / 255.0, 248.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gold'. - static Vector4 get gold => - Vector4(255.0 / 255.0, 215.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get gold => Vector4(255.0 / 255.0, 215.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'goldenrod'. static Vector4 get goldenrod => Vector4(218.0 / 255.0, 165.0 / 255.0, 32.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gray'. - static Vector4 get gray => - Vector4(128.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get gray => Vector4(128.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'green'. - static Vector4 get green => - Vector4(0.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get green => Vector4(0.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'greenyellow'. static Vector4 get greenYellow => @@ -521,24 +472,19 @@ class Colors { Vector4(240.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'hotpink'. - static Vector4 get hotPink => - Vector4(255.0 / 255.0, 105.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); + static Vector4 get hotPink => Vector4(255.0 / 255.0, 105.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'indianred'. - static Vector4 get indianRed => - Vector4(205.0 / 255.0, 92.0 / 255.0, 92.0 / 255.0, 255.0 / 255.0); + static Vector4 get indianRed => Vector4(205.0 / 255.0, 92.0 / 255.0, 92.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'indigo'. - static Vector4 get indigo => - Vector4(75.0 / 255.0, 0.0 / 255.0, 130.0 / 255.0, 255.0 / 255.0); + static Vector4 get indigo => Vector4(75.0 / 255.0, 0.0 / 255.0, 130.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'ivory'. - static Vector4 get ivory => - Vector4(255.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); + static Vector4 get ivory => Vector4(255.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'khaki'. - static Vector4 get khaki => - Vector4(240.0 / 255.0, 230.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); + static Vector4 get khaki => Vector4(240.0 / 255.0, 230.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lavender'. static Vector4 get lavender => @@ -549,8 +495,7 @@ class Colors { Vector4(255.0 / 255.0, 240.0 / 255.0, 245.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lawngreen'. - static Vector4 get lawnGreen => - Vector4(124.0 / 255.0, 252.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get lawnGreen => Vector4(124.0 / 255.0, 252.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lemonchiffon'. static Vector4 get lemonChiffon => @@ -609,32 +554,26 @@ class Colors { Vector4(255.0 / 255.0, 255.0 / 255.0, 224.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lime'. - static Vector4 get lime => - Vector4(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get lime => Vector4(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'limegreen'. - static Vector4 get limeGreen => - Vector4(50.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 255.0 / 255.0); + static Vector4 get limeGreen => Vector4(50.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'linen'. - static Vector4 get linen => - Vector4(250.0 / 255.0, 240.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); + static Vector4 get linen => Vector4(250.0 / 255.0, 240.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'magenta'. - static Vector4 get magenta => - Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get magenta => Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'maroon'. - static Vector4 get maroon => - Vector4(128.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get maroon => Vector4(128.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumaquamarine'. static Vector4 get mediumAquamarine => Vector4(102.0 / 255.0, 205.0 / 255.0, 170.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumblue'. - static Vector4 get mediumBlue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); + static Vector4 get mediumBlue => Vector4(0.0 / 255.0, 0.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumorchid'. static Vector4 get mediumOrchid => @@ -685,32 +624,26 @@ class Colors { Vector4(255.0 / 255.0, 222.0 / 255.0, 173.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'navy'. - static Vector4 get navy => - Vector4(0.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get navy => Vector4(0.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'oldlace'. - static Vector4 get oldLace => - Vector4(253.0 / 255.0, 245.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); + static Vector4 get oldLace => Vector4(253.0 / 255.0, 245.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'olive'. - static Vector4 get olive => - Vector4(128.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get olive => Vector4(128.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'olivedrab'. static Vector4 get oliveDrab => Vector4(107.0 / 255.0, 142.0 / 255.0, 35.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orange'. - static Vector4 get orange => - Vector4(255.0 / 255.0, 165.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get orange => Vector4(255.0 / 255.0, 165.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orangered'. - static Vector4 get orangeRed => - Vector4(255.0 / 255.0, 69.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get orangeRed => Vector4(255.0 / 255.0, 69.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orchid'. - static Vector4 get orchid => - Vector4(218.0 / 255.0, 112.0 / 255.0, 214.0 / 255.0, 255.0 / 255.0); + static Vector4 get orchid => Vector4(218.0 / 255.0, 112.0 / 255.0, 214.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'palegoldenrod'. static Vector4 get paleGoldenrod => @@ -737,28 +670,23 @@ class Colors { Vector4(255.0 / 255.0, 218.0 / 255.0, 185.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'peru'. - static Vector4 get peru => - Vector4(205.0 / 255.0, 133.0 / 255.0, 63.0 / 255.0, 255.0 / 255.0); + static Vector4 get peru => Vector4(205.0 / 255.0, 133.0 / 255.0, 63.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'pink'. - static Vector4 get pink => - Vector4(255.0 / 255.0, 192.0 / 255.0, 203.0 / 255.0, 255.0 / 255.0); + static Vector4 get pink => Vector4(255.0 / 255.0, 192.0 / 255.0, 203.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'plum'. - static Vector4 get plum => - Vector4(221.0 / 255.0, 160.0 / 255.0, 221.0 / 255.0, 255.0 / 255.0); + static Vector4 get plum => Vector4(221.0 / 255.0, 160.0 / 255.0, 221.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'powderblue'. static Vector4 get powderBlue => Vector4(176.0 / 255.0, 224.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'purple'. - static Vector4 get purple => - Vector4(128.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get purple => Vector4(128.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'red'. - static Vector4 get red => - Vector4(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get red => Vector4(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'rosybrown'. static Vector4 get rosyBrown => @@ -773,32 +701,27 @@ class Colors { Vector4(139.0 / 255.0, 69.0 / 255.0, 19.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'salmon'. - static Vector4 get salmon => - Vector4(250.0 / 255.0, 128.0 / 255.0, 114.0 / 255.0, 255.0 / 255.0); + static Vector4 get salmon => Vector4(250.0 / 255.0, 128.0 / 255.0, 114.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'sandybrown'. static Vector4 get sandyBrown => Vector4(244.0 / 255.0, 164.0 / 255.0, 96.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'seagreen'. - static Vector4 get seaGreen => - Vector4(46.0 / 255.0, 139.0 / 255.0, 87.0 / 255.0, 255.0 / 255.0); + static Vector4 get seaGreen => Vector4(46.0 / 255.0, 139.0 / 255.0, 87.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'seashell'. static Vector4 get seaShell => Vector4(255.0 / 255.0, 245.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'sienna'. - static Vector4 get sienna => - Vector4(160.0 / 255.0, 82.0 / 255.0, 45.0 / 255.0, 255.0 / 255.0); + static Vector4 get sienna => Vector4(160.0 / 255.0, 82.0 / 255.0, 45.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'silver'. - static Vector4 get silver => - Vector4(192.0 / 255.0, 192.0 / 255.0, 192.0 / 255.0, 255.0 / 255.0); + static Vector4 get silver => Vector4(192.0 / 255.0, 192.0 / 255.0, 192.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'skyblue'. - static Vector4 get skyBlue => - Vector4(135.0 / 255.0, 206.0 / 255.0, 235.0 / 255.0, 255.0 / 255.0); + static Vector4 get skyBlue => Vector4(135.0 / 255.0, 206.0 / 255.0, 235.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'slateblue'. static Vector4 get slateBlue => @@ -809,8 +732,7 @@ class Colors { Vector4(112.0 / 255.0, 128.0 / 255.0, 144.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'snow'. - static Vector4 get snow => - Vector4(255.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0, 255.0 / 255.0); + static Vector4 get snow => Vector4(255.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'springgreen'. static Vector4 get springGreen => @@ -821,44 +743,36 @@ class Colors { Vector4(70.0 / 255.0, 130.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'tan'. - static Vector4 get tan => - Vector4(210.0 / 255.0, 180.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); + static Vector4 get tan => Vector4(210.0 / 255.0, 180.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'teal'. - static Vector4 get teal => - Vector4(0.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get teal => Vector4(0.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'thistle'. - static Vector4 get thistle => - Vector4(216.0 / 255.0, 191.0 / 255.0, 216.0 / 255.0, 255.0 / 255.0); + static Vector4 get thistle => Vector4(216.0 / 255.0, 191.0 / 255.0, 216.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'tomato'. - static Vector4 get tomato => - Vector4(255.0 / 255.0, 99.0 / 255.0, 71.0 / 255.0, 255.0 / 255.0); + static Vector4 get tomato => Vector4(255.0 / 255.0, 99.0 / 255.0, 71.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'turquoise'. static Vector4 get turquoise => Vector4(64.0 / 255.0, 224.0 / 255.0, 208.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'violet'. - static Vector4 get violet => - Vector4(238.0 / 255.0, 130.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); + static Vector4 get violet => Vector4(238.0 / 255.0, 130.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'wheat'. - static Vector4 get wheat => - Vector4(245.0 / 255.0, 222.0 / 255.0, 179.0 / 255.0, 255.0 / 255.0); + static Vector4 get wheat => Vector4(245.0 / 255.0, 222.0 / 255.0, 179.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'white'. - static Vector4 get white => - Vector4(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get white => Vector4(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'whitesmoke'. static Vector4 get whiteSmoke => Vector4(245.0 / 255.0, 245.0 / 255.0, 245.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'yellow'. - static Vector4 get yellow => - Vector4(255.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get yellow => Vector4(255.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'yellowgreen'. static Vector4 get yellowGreen => diff --git a/packages/vector_math/lib/src/vector_math/matrix2.dart b/packages/vector_math/lib/src/vector_math/matrix2.dart index 5be5803..be9b46a 100644 --- a/packages/vector_math/lib/src/vector_math/matrix2.dart +++ b/packages/vector_math/lib/src/vector_math/matrix2.dart @@ -27,15 +27,13 @@ class Matrix2 { factory Matrix2.copy(Matrix2 other) => Matrix2.zero()..setFrom(other); /// Matrix with values from column arguments. - factory Matrix2.columns(Vector2 arg0, Vector2 arg1) => - Matrix2.zero()..setColumns(arg0, arg1); + factory Matrix2.columns(Vector2 arg0, Vector2 arg1) => Matrix2.zero()..setColumns(arg0, arg1); /// Outer product of [u] and [v]. factory Matrix2.outer(Vector2 u, Vector2 v) => Matrix2.zero()..setOuter(u, v); /// Rotation of [radians]. - factory Matrix2.rotation(double radians) => - Matrix2.zero()..setRotation(radians); + factory Matrix2.rotation(double radians) => Matrix2.zero()..setRotation(radians); final Float32List _m2storage; /// The components of the matrix. @@ -282,8 +280,7 @@ class Matrix2 { } /// Returns the determinant of this matrix. - double determinant() => - (_m2storage[0] * _m2storage[3]) - (_m2storage[1] * _m2storage[2]); + double determinant() => (_m2storage[0] * _m2storage[3]) - (_m2storage[1] * _m2storage[2]); /// Returns the dot product of row [i] and [v]. double dotRow(int i, Vector2 v) { @@ -294,8 +291,7 @@ class Matrix2 { /// Returns the dot product of column [j] and [v]. double dotColumn(int j, Vector2 v) { final Float32List vStorage = v._v2storage; - return _m2storage[j * 2] * vStorage[0] + - _m2storage[(j * 2) + 1] * vStorage[1]; + return _m2storage[j * 2] * vStorage[0] + _m2storage[(j * 2) + 1] * vStorage[1]; } /// Trace of the matrix. @@ -477,10 +473,8 @@ class Matrix2 { /// this. Vector2 transform(Vector2 arg) { final Float32List argStorage = arg._v2storage; - final double x = - (_m2storage[0] * argStorage[0]) + (_m2storage[2] * argStorage[1]); - final double y = - (_m2storage[1] * argStorage[0]) + (_m2storage[3] * argStorage[1]); + final double x = (_m2storage[0] * argStorage[0]) + (_m2storage[2] * argStorage[1]); + final double y = (_m2storage[1] * argStorage[0]) + (_m2storage[3] * argStorage[1]); argStorage[0] = x; argStorage[1] = y; return arg; diff --git a/packages/vector_math/lib/src/vector_math/matrix3.dart b/packages/vector_math/lib/src/vector_math/matrix3.dart index a008e35..d5c4744 100644 --- a/packages/vector_math/lib/src/vector_math/matrix3.dart +++ b/packages/vector_math/lib/src/vector_math/matrix3.dart @@ -22,9 +22,7 @@ class Matrix3 { double arg6, double arg7, double arg8, - ) => - Matrix3.zero() - ..setValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + ) => Matrix3.zero()..setValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); /// New matrix from [values]. factory Matrix3.fromList(List values) => Matrix3.zero() @@ -60,16 +58,13 @@ class Matrix3 { factory Matrix3.outer(Vector3 u, Vector3 v) => Matrix3.zero()..setOuter(u, v); /// Rotation of [radians] around X axis. - factory Matrix3.rotationX(double radians) => - Matrix3.zero()..setRotationX(radians); + factory Matrix3.rotationX(double radians) => Matrix3.zero()..setRotationX(radians); /// Rotation of [radians] around Y axis. - factory Matrix3.rotationY(double radians) => - Matrix3.zero()..setRotationY(radians); + factory Matrix3.rotationY(double radians) => Matrix3.zero()..setRotationY(radians); /// Rotation of [radians] around Z axis. - factory Matrix3.rotationZ(double radians) => - Matrix3.zero()..setRotationZ(radians); + factory Matrix3.rotationZ(double radians) => Matrix3.zero()..setRotationZ(radians); final Float32List _m3storage; /// The components of the matrix. @@ -449,14 +444,11 @@ class Matrix3 { /// Returns the determinant of this matrix. double determinant() { final double x = - _m3storage[0] * - ((_m3storage[4] * _m3storage[8]) - (_m3storage[5] * _m3storage[7])); + _m3storage[0] * ((_m3storage[4] * _m3storage[8]) - (_m3storage[5] * _m3storage[7])); final double y = - _m3storage[1] * - ((_m3storage[3] * _m3storage[8]) - (_m3storage[5] * _m3storage[6])); + _m3storage[1] * ((_m3storage[3] * _m3storage[8]) - (_m3storage[5] * _m3storage[6])); final double z = - _m3storage[2] * - ((_m3storage[3] * _m3storage[7]) - (_m3storage[4] * _m3storage[6])); + _m3storage[2] * ((_m3storage[3] * _m3storage[7]) - (_m3storage[4] * _m3storage[6])); return x - y + z; } @@ -541,33 +533,15 @@ class Matrix3 { } final double invDet = 1.0 / det; final Float32List argStorage = arg._m3storage; - final double ix = - invDet * - (argStorage[4] * argStorage[8] - argStorage[5] * argStorage[7]); - final double iy = - invDet * - (argStorage[2] * argStorage[7] - argStorage[1] * argStorage[8]); - final double iz = - invDet * - (argStorage[1] * argStorage[5] - argStorage[2] * argStorage[4]); - final double jx = - invDet * - (argStorage[5] * argStorage[6] - argStorage[3] * argStorage[8]); - final double jy = - invDet * - (argStorage[0] * argStorage[8] - argStorage[2] * argStorage[6]); - final double jz = - invDet * - (argStorage[2] * argStorage[3] - argStorage[0] * argStorage[5]); - final double kx = - invDet * - (argStorage[3] * argStorage[7] - argStorage[4] * argStorage[6]); - final double ky = - invDet * - (argStorage[1] * argStorage[6] - argStorage[0] * argStorage[7]); - final double kz = - invDet * - (argStorage[0] * argStorage[4] - argStorage[1] * argStorage[3]); + final double ix = invDet * (argStorage[4] * argStorage[8] - argStorage[5] * argStorage[7]); + final double iy = invDet * (argStorage[2] * argStorage[7] - argStorage[1] * argStorage[8]); + final double iz = invDet * (argStorage[1] * argStorage[5] - argStorage[2] * argStorage[4]); + final double jx = invDet * (argStorage[5] * argStorage[6] - argStorage[3] * argStorage[8]); + final double jy = invDet * (argStorage[0] * argStorage[8] - argStorage[2] * argStorage[6]); + final double jz = invDet * (argStorage[2] * argStorage[3] - argStorage[0] * argStorage[5]); + final double kx = invDet * (argStorage[3] * argStorage[7] - argStorage[4] * argStorage[6]); + final double ky = invDet * (argStorage[1] * argStorage[6] - argStorage[0] * argStorage[7]); + final double kz = invDet * (argStorage[0] * argStorage[4] - argStorage[1] * argStorage[3]); _m3storage[0] = ix; _m3storage[1] = iy; _m3storage[2] = iz; @@ -696,13 +670,9 @@ class Matrix3 { Vector2 transform2(Vector2 arg) { final Float32List argStorage = arg._v2storage; final double x_ = - (_m3storage[0] * argStorage[0]) + - (_m3storage[3] * argStorage[1]) + - _m3storage[6]; + (_m3storage[0] * argStorage[0]) + (_m3storage[3] * argStorage[1]) + _m3storage[6]; final double y_ = - (_m3storage[1] * argStorage[0]) + - (_m3storage[4] * argStorage[1]) + - _m3storage[7]; + (_m3storage[1] * argStorage[0]) + (_m3storage[4] * argStorage[1]) + _m3storage[7]; argStorage[0] = x_; argStorage[1] = y_; return arg; @@ -811,24 +781,15 @@ class Matrix3 { final double m21 = _m3storage[7]; final double m22 = _m3storage[8]; final Float32List argStorage = arg._m3storage; - _m3storage[0] = - (m00 * argStorage[0]) + (m01 * argStorage[1]) + (m02 * argStorage[2]); - _m3storage[3] = - (m00 * argStorage[3]) + (m01 * argStorage[4]) + (m02 * argStorage[5]); - _m3storage[6] = - (m00 * argStorage[6]) + (m01 * argStorage[7]) + (m02 * argStorage[8]); - _m3storage[1] = - (m10 * argStorage[0]) + (m11 * argStorage[1]) + (m12 * argStorage[2]); - _m3storage[4] = - (m10 * argStorage[3]) + (m11 * argStorage[4]) + (m12 * argStorage[5]); - _m3storage[7] = - (m10 * argStorage[6]) + (m11 * argStorage[7]) + (m12 * argStorage[8]); - _m3storage[2] = - (m20 * argStorage[0]) + (m21 * argStorage[1]) + (m22 * argStorage[2]); - _m3storage[5] = - (m20 * argStorage[3]) + (m21 * argStorage[4]) + (m22 * argStorage[5]); - _m3storage[8] = - (m20 * argStorage[6]) + (m21 * argStorage[7]) + (m22 * argStorage[8]); + _m3storage[0] = (m00 * argStorage[0]) + (m01 * argStorage[1]) + (m02 * argStorage[2]); + _m3storage[3] = (m00 * argStorage[3]) + (m01 * argStorage[4]) + (m02 * argStorage[5]); + _m3storage[6] = (m00 * argStorage[6]) + (m01 * argStorage[7]) + (m02 * argStorage[8]); + _m3storage[1] = (m10 * argStorage[0]) + (m11 * argStorage[1]) + (m12 * argStorage[2]); + _m3storage[4] = (m10 * argStorage[3]) + (m11 * argStorage[4]) + (m12 * argStorage[5]); + _m3storage[7] = (m10 * argStorage[6]) + (m11 * argStorage[7]) + (m12 * argStorage[8]); + _m3storage[2] = (m20 * argStorage[0]) + (m21 * argStorage[1]) + (m22 * argStorage[2]); + _m3storage[5] = (m20 * argStorage[3]) + (m21 * argStorage[4]) + (m22 * argStorage[5]); + _m3storage[8] = (m20 * argStorage[6]) + (m21 * argStorage[7]) + (m22 * argStorage[8]); } void multiplyTranspose(Matrix3 arg) { @@ -842,24 +803,15 @@ class Matrix3 { final double m21 = _m3storage[5]; final double m22 = _m3storage[8]; final Float32List argStorage = arg._m3storage; - _m3storage[0] = - (m00 * argStorage[0]) + (m01 * argStorage[3]) + (m02 * argStorage[6]); - _m3storage[3] = - (m00 * argStorage[1]) + (m01 * argStorage[4]) + (m02 * argStorage[7]); - _m3storage[6] = - (m00 * argStorage[2]) + (m01 * argStorage[5]) + (m02 * argStorage[8]); - _m3storage[1] = - (m10 * argStorage[0]) + (m11 * argStorage[3]) + (m12 * argStorage[6]); - _m3storage[4] = - (m10 * argStorage[1]) + (m11 * argStorage[4]) + (m12 * argStorage[7]); - _m3storage[7] = - (m10 * argStorage[2]) + (m11 * argStorage[5]) + (m12 * argStorage[8]); - _m3storage[2] = - (m20 * argStorage[0]) + (m21 * argStorage[3]) + (m22 * argStorage[6]); - _m3storage[5] = - (m20 * argStorage[1]) + (m21 * argStorage[4]) + (m22 * argStorage[7]); - _m3storage[8] = - (m20 * argStorage[2]) + (m21 * argStorage[5]) + (m22 * argStorage[8]); + _m3storage[0] = (m00 * argStorage[0]) + (m01 * argStorage[3]) + (m02 * argStorage[6]); + _m3storage[3] = (m00 * argStorage[1]) + (m01 * argStorage[4]) + (m02 * argStorage[7]); + _m3storage[6] = (m00 * argStorage[2]) + (m01 * argStorage[5]) + (m02 * argStorage[8]); + _m3storage[1] = (m10 * argStorage[0]) + (m11 * argStorage[3]) + (m12 * argStorage[6]); + _m3storage[4] = (m10 * argStorage[1]) + (m11 * argStorage[4]) + (m12 * argStorage[7]); + _m3storage[7] = (m10 * argStorage[2]) + (m11 * argStorage[5]) + (m12 * argStorage[8]); + _m3storage[2] = (m20 * argStorage[0]) + (m21 * argStorage[3]) + (m22 * argStorage[6]); + _m3storage[5] = (m20 * argStorage[1]) + (m21 * argStorage[4]) + (m22 * argStorage[7]); + _m3storage[8] = (m20 * argStorage[2]) + (m21 * argStorage[5]) + (m22 * argStorage[8]); } /// Transform [arg] of type [Vector3] using the transformation defined by diff --git a/packages/vector_math/lib/src/vector_math/matrix4.dart b/packages/vector_math/lib/src/vector_math/matrix4.dart index 0132293..06730a9 100644 --- a/packages/vector_math/lib/src/vector_math/matrix4.dart +++ b/packages/vector_math/lib/src/vector_math/matrix4.dart @@ -94,12 +94,8 @@ class Matrix4 { } /// Constructs a new mat4 from columns. - factory Matrix4.columns( - Vector4 arg0, - Vector4 arg1, - Vector4 arg2, - Vector4 arg3, - ) => Matrix4.zero()..setColumns(arg0, arg1, arg2, arg3); + factory Matrix4.columns(Vector4 arg0, Vector4 arg1, Vector4 arg2, Vector4 arg3) => + Matrix4.zero()..setColumns(arg0, arg1, arg2, arg3); /// Outer product of [u] and [v]. factory Matrix4.outer(Vector4 u, Vector4 v) => Matrix4.zero()..setOuter(u, v); @@ -125,10 +121,9 @@ class Matrix4 { ..setTranslation(translation); /// Translation matrix. - factory Matrix4.translationValues(double x, double y, double z) => - Matrix4.zero() - ..setIdentity() - ..setTranslationRaw(x, y, z); + factory Matrix4.translationValues(double x, double y, double z) => Matrix4.zero() + ..setIdentity() + ..setTranslationRaw(x, y, z); /// Scale matrix. factory Matrix4.diagonal3(Vector3 scale) { @@ -143,12 +138,11 @@ class Matrix4 { } /// Scale matrix. - factory Matrix4.diagonal3Values(double x, double y, double z) => - Matrix4.zero() - .._m4storage[15] = 1.0 - .._m4storage[10] = z - .._m4storage[5] = y - .._m4storage[0] = x; + factory Matrix4.diagonal3Values(double x, double y, double z) => Matrix4.zero() + .._m4storage[15] = 1.0 + .._m4storage[10] = z + .._m4storage[5] = y + .._m4storage[0] = x; /// Skew matrix around X axis factory Matrix4.skewX(double alpha) { @@ -181,13 +175,8 @@ class Matrix4 { : _m4storage = Float32List.view(buffer, offset, 16); /// Constructs Matrix4 from [translation], [rotation] and [scale]. - factory Matrix4.compose( - Vector3 translation, - Quaternion rotation, - Vector3 scale, - ) => - Matrix4.zero() - ..setFromTranslationRotationScale(translation, rotation, scale); + factory Matrix4.compose(Vector3 translation, Quaternion rotation, Vector3 scale) => + Matrix4.zero()..setFromTranslationRotationScale(translation, rotation, scale); final Float32List _m4storage; /// The components of the matrix. @@ -299,8 +288,7 @@ class Matrix4 { final double bZ = b.storage[2]; final double bW = b.storage[3]; - double det = - b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + double det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (det != 0.0) { det = 1.0 / det; @@ -493,11 +481,7 @@ class Matrix4 { } /// Sets the matrix from [translation], [rotation] and [scale]. - void setFromTranslationRotationScale( - Vector3 translation, - Quaternion rotation, - Vector3 scale, - ) { + void setFromTranslationRotationScale(Vector3 translation, Quaternion rotation, Vector3 scale) { setFromTranslationRotation(translation, rotation); scaleByVector3(scale); } @@ -736,31 +720,19 @@ class Matrix4 { /// Translate this matrix by x, y, z, w. void translateByDouble(double tx, double ty, double tz, double tw) { final double t1 = - _m4storage[0] * tx + - _m4storage[4] * ty + - _m4storage[8] * tz + - _m4storage[12] * tw; + _m4storage[0] * tx + _m4storage[4] * ty + _m4storage[8] * tz + _m4storage[12] * tw; _m4storage[12] = t1; final double t2 = - _m4storage[1] * tx + - _m4storage[5] * ty + - _m4storage[9] * tz + - _m4storage[13] * tw; + _m4storage[1] * tx + _m4storage[5] * ty + _m4storage[9] * tz + _m4storage[13] * tw; _m4storage[13] = t2; final double t3 = - _m4storage[2] * tx + - _m4storage[6] * ty + - _m4storage[10] * tz + - _m4storage[14] * tw; + _m4storage[2] * tx + _m4storage[6] * ty + _m4storage[10] * tz + _m4storage[14] * tw; _m4storage[14] = t3; final double t4 = - _m4storage[3] * tx + - _m4storage[7] * ty + - _m4storage[11] * tz + - _m4storage[15] * tw; + _m4storage[3] * tx + _m4storage[7] * ty + _m4storage[11] * tz + _m4storage[15] * tw; _m4storage[15] = t4; } @@ -768,22 +740,19 @@ class Matrix4 { @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector2(Vector2 v2) => - translateByDouble(v2.x, v2.y, 0.0, 1.0); + void translateByVector2(Vector2 v2) => translateByDouble(v2.x, v2.y, 0.0, 1.0); /// Translate this matrix by a [Vector3]. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector3(Vector3 v3) => - translateByDouble(v3.x, v3.y, v3.z, 1.0); + void translateByVector3(Vector3 v3) => translateByDouble(v3.x, v3.y, v3.z, 1.0); /// Translate this matrix by a [Vector4]. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector4(Vector4 v4) => - translateByDouble(v4.x, v4.y, v4.z, v4.w); + void translateByVector4(Vector4 v4) => translateByDouble(v4.x, v4.y, v4.z, v4.w); /// Multiply this by a translation from the left. /// @@ -847,22 +816,19 @@ class Matrix4 { @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector2(Vector2 v2) => - leftTranslateByDouble(v2.x, v2.y, 0.0, 1.0); + void leftTranslateByVector2(Vector2 v2) => leftTranslateByDouble(v2.x, v2.y, 0.0, 1.0); /// Multiply this by a translation from the left. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector3(Vector3 v3) => - leftTranslateByDouble(v3.x, v3.y, v3.z, 1.0); + void leftTranslateByVector3(Vector3 v3) => leftTranslateByDouble(v3.x, v3.y, v3.z, 1.0); /// Multiply this by a translation from the left. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector4(Vector4 v4) => - leftTranslateByDouble(v4.x, v4.y, v4.z, v4.w); + void leftTranslateByVector4(Vector4 v4) => leftTranslateByDouble(v4.x, v4.y, v4.z, v4.w); /// Rotate this [angle] radians around [axis] void rotate(Vector3 axis, double angle) { @@ -883,30 +849,18 @@ class Matrix4 { final double m31 = z * x * C - y * s; final double m32 = z * y * C + x * s; final double m33 = z * z * C + c; - final double t1 = - _m4storage[0] * m11 + _m4storage[4] * m21 + _m4storage[8] * m31; - final double t2 = - _m4storage[1] * m11 + _m4storage[5] * m21 + _m4storage[9] * m31; - final double t3 = - _m4storage[2] * m11 + _m4storage[6] * m21 + _m4storage[10] * m31; - final double t4 = - _m4storage[3] * m11 + _m4storage[7] * m21 + _m4storage[11] * m31; - final double t5 = - _m4storage[0] * m12 + _m4storage[4] * m22 + _m4storage[8] * m32; - final double t6 = - _m4storage[1] * m12 + _m4storage[5] * m22 + _m4storage[9] * m32; - final double t7 = - _m4storage[2] * m12 + _m4storage[6] * m22 + _m4storage[10] * m32; - final double t8 = - _m4storage[3] * m12 + _m4storage[7] * m22 + _m4storage[11] * m32; - final double t9 = - _m4storage[0] * m13 + _m4storage[4] * m23 + _m4storage[8] * m33; - final double t10 = - _m4storage[1] * m13 + _m4storage[5] * m23 + _m4storage[9] * m33; - final double t11 = - _m4storage[2] * m13 + _m4storage[6] * m23 + _m4storage[10] * m33; - final double t12 = - _m4storage[3] * m13 + _m4storage[7] * m23 + _m4storage[11] * m33; + final double t1 = _m4storage[0] * m11 + _m4storage[4] * m21 + _m4storage[8] * m31; + final double t2 = _m4storage[1] * m11 + _m4storage[5] * m21 + _m4storage[9] * m31; + final double t3 = _m4storage[2] * m11 + _m4storage[6] * m21 + _m4storage[10] * m31; + final double t4 = _m4storage[3] * m11 + _m4storage[7] * m21 + _m4storage[11] * m31; + final double t5 = _m4storage[0] * m12 + _m4storage[4] * m22 + _m4storage[8] * m32; + final double t6 = _m4storage[1] * m12 + _m4storage[5] * m22 + _m4storage[9] * m32; + final double t7 = _m4storage[2] * m12 + _m4storage[6] * m22 + _m4storage[10] * m32; + final double t8 = _m4storage[3] * m12 + _m4storage[7] * m22 + _m4storage[11] * m32; + final double t9 = _m4storage[0] * m13 + _m4storage[4] * m23 + _m4storage[8] * m33; + final double t10 = _m4storage[1] * m13 + _m4storage[5] * m23 + _m4storage[9] * m33; + final double t11 = _m4storage[2] * m13 + _m4storage[6] * m23 + _m4storage[10] * m33; + final double t12 = _m4storage[3] * m13 + _m4storage[7] * m23 + _m4storage[11] * m33; _m4storage[0] = t1; _m4storage[1] = t2; _m4storage[2] = t3; @@ -1156,34 +1110,20 @@ class Matrix4 { /// Returns the determinant of this matrix. double determinant() { - final double det2_01_01 = - _m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]; - final double det2_01_02 = - _m4storage[0] * _m4storage[6] - _m4storage[2] * _m4storage[4]; - final double det2_01_03 = - _m4storage[0] * _m4storage[7] - _m4storage[3] * _m4storage[4]; - final double det2_01_12 = - _m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]; - final double det2_01_13 = - _m4storage[1] * _m4storage[7] - _m4storage[3] * _m4storage[5]; - final double det2_01_23 = - _m4storage[2] * _m4storage[7] - _m4storage[3] * _m4storage[6]; + final double det2_01_01 = _m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]; + final double det2_01_02 = _m4storage[0] * _m4storage[6] - _m4storage[2] * _m4storage[4]; + final double det2_01_03 = _m4storage[0] * _m4storage[7] - _m4storage[3] * _m4storage[4]; + final double det2_01_12 = _m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]; + final double det2_01_13 = _m4storage[1] * _m4storage[7] - _m4storage[3] * _m4storage[5]; + final double det2_01_23 = _m4storage[2] * _m4storage[7] - _m4storage[3] * _m4storage[6]; final double det3_201_012 = - _m4storage[8] * det2_01_12 - - _m4storage[9] * det2_01_02 + - _m4storage[10] * det2_01_01; + _m4storage[8] * det2_01_12 - _m4storage[9] * det2_01_02 + _m4storage[10] * det2_01_01; final double det3_201_013 = - _m4storage[8] * det2_01_13 - - _m4storage[9] * det2_01_03 + - _m4storage[11] * det2_01_01; + _m4storage[8] * det2_01_13 - _m4storage[9] * det2_01_03 + _m4storage[11] * det2_01_01; final double det3_201_023 = - _m4storage[8] * det2_01_23 - - _m4storage[10] * det2_01_03 + - _m4storage[11] * det2_01_02; + _m4storage[8] * det2_01_23 - _m4storage[10] * det2_01_03 + _m4storage[11] * det2_01_02; final double det3_201_123 = - _m4storage[9] * det2_01_23 - - _m4storage[10] * det2_01_13 + - _m4storage[11] * det2_01_12; + _m4storage[9] * det2_01_23 - _m4storage[10] * det2_01_13 + _m4storage[11] * det2_01_12; return -det3_201_123 * _m4storage[12] + det3_201_023 * _m4storage[13] - det3_201_013 * _m4storage[14] + @@ -1416,8 +1356,7 @@ class Matrix4 { final double b09 = a21 * a32 - a22 * a31; 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; + final double det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (det == 0.0) { setFrom(arg); return 0.0; @@ -1457,33 +1396,15 @@ class Matrix4 { double kx; double ky; double kz; - ix = - invDet * - (_m4storage[5] * _m4storage[10] - _m4storage[6] * _m4storage[9]); - iy = - invDet * - (_m4storage[2] * _m4storage[9] - _m4storage[1] * _m4storage[10]); - iz = - invDet * - (_m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]); - jx = - invDet * - (_m4storage[6] * _m4storage[8] - _m4storage[4] * _m4storage[10]); - jy = - invDet * - (_m4storage[0] * _m4storage[10] - _m4storage[2] * _m4storage[8]); - jz = - invDet * - (_m4storage[2] * _m4storage[4] - _m4storage[0] * _m4storage[6]); - kx = - invDet * - (_m4storage[4] * _m4storage[9] - _m4storage[5] * _m4storage[8]); - ky = - invDet * - (_m4storage[1] * _m4storage[8] - _m4storage[0] * _m4storage[9]); - kz = - invDet * - (_m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]); + ix = invDet * (_m4storage[5] * _m4storage[10] - _m4storage[6] * _m4storage[9]); + iy = invDet * (_m4storage[2] * _m4storage[9] - _m4storage[1] * _m4storage[10]); + iz = invDet * (_m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]); + jx = invDet * (_m4storage[6] * _m4storage[8] - _m4storage[4] * _m4storage[10]); + jy = invDet * (_m4storage[0] * _m4storage[10] - _m4storage[2] * _m4storage[8]); + jz = invDet * (_m4storage[2] * _m4storage[4] - _m4storage[0] * _m4storage[6]); + kx = invDet * (_m4storage[4] * _m4storage[9] - _m4storage[5] * _m4storage[8]); + ky = invDet * (_m4storage[1] * _m4storage[8] - _m4storage[0] * _m4storage[9]); + kz = invDet * (_m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]); _m4storage[0] = ix; _m4storage[1] = iy; _m4storage[2] = iz; @@ -1570,85 +1491,37 @@ class Matrix4 { final double c4 = _m4storage[11]; final double d4 = _m4storage[15]; _m4storage[0] = - (b2 * (c3 * d4 - c4 * d3) - - c2 * (b3 * d4 - b4 * d3) + - d2 * (b3 * c4 - b4 * c3)) * - scale; + (b2 * (c3 * d4 - c4 * d3) - c2 * (b3 * d4 - b4 * d3) + d2 * (b3 * c4 - b4 * c3)) * scale; _m4storage[1] = - -(a2 * (c3 * d4 - c4 * d3) - - c2 * (a3 * d4 - a4 * d3) + - d2 * (a3 * c4 - a4 * c3)) * - scale; + -(a2 * (c3 * d4 - c4 * d3) - c2 * (a3 * d4 - a4 * d3) + d2 * (a3 * c4 - a4 * c3)) * scale; _m4storage[2] = - (a2 * (b3 * d4 - b4 * d3) - - b2 * (a3 * d4 - a4 * d3) + - d2 * (a3 * b4 - a4 * b3)) * - scale; + (a2 * (b3 * d4 - b4 * d3) - b2 * (a3 * d4 - a4 * d3) + d2 * (a3 * b4 - a4 * b3)) * scale; _m4storage[3] = - -(a2 * (b3 * c4 - b4 * c3) - - b2 * (a3 * c4 - a4 * c3) + - c2 * (a3 * b4 - a4 * b3)) * - scale; + -(a2 * (b3 * c4 - b4 * c3) - b2 * (a3 * c4 - a4 * c3) + c2 * (a3 * b4 - a4 * b3)) * scale; _m4storage[4] = - -(b1 * (c3 * d4 - c4 * d3) - - c1 * (b3 * d4 - b4 * d3) + - d1 * (b3 * c4 - b4 * c3)) * - scale; + -(b1 * (c3 * d4 - c4 * d3) - c1 * (b3 * d4 - b4 * d3) + d1 * (b3 * c4 - b4 * c3)) * scale; _m4storage[5] = - (a1 * (c3 * d4 - c4 * d3) - - c1 * (a3 * d4 - a4 * d3) + - d1 * (a3 * c4 - a4 * c3)) * - scale; + (a1 * (c3 * d4 - c4 * d3) - c1 * (a3 * d4 - a4 * d3) + d1 * (a3 * c4 - a4 * c3)) * scale; _m4storage[6] = - -(a1 * (b3 * d4 - b4 * d3) - - b1 * (a3 * d4 - a4 * d3) + - d1 * (a3 * b4 - a4 * b3)) * - scale; + -(a1 * (b3 * d4 - b4 * d3) - b1 * (a3 * d4 - a4 * d3) + d1 * (a3 * b4 - a4 * b3)) * scale; _m4storage[7] = - (a1 * (b3 * c4 - b4 * c3) - - b1 * (a3 * c4 - a4 * c3) + - c1 * (a3 * b4 - a4 * b3)) * - scale; + (a1 * (b3 * c4 - b4 * c3) - b1 * (a3 * c4 - a4 * c3) + c1 * (a3 * b4 - a4 * b3)) * scale; _m4storage[8] = - (b1 * (c2 * d4 - c4 * d2) - - c1 * (b2 * d4 - b4 * d2) + - d1 * (b2 * c4 - b4 * c2)) * - scale; + (b1 * (c2 * d4 - c4 * d2) - c1 * (b2 * d4 - b4 * d2) + d1 * (b2 * c4 - b4 * c2)) * scale; _m4storage[9] = - -(a1 * (c2 * d4 - c4 * d2) - - c1 * (a2 * d4 - a4 * d2) + - d1 * (a2 * c4 - a4 * c2)) * - scale; + -(a1 * (c2 * d4 - c4 * d2) - c1 * (a2 * d4 - a4 * d2) + d1 * (a2 * c4 - a4 * c2)) * scale; _m4storage[10] = - (a1 * (b2 * d4 - b4 * d2) - - b1 * (a2 * d4 - a4 * d2) + - d1 * (a2 * b4 - a4 * b2)) * - scale; + (a1 * (b2 * d4 - b4 * d2) - b1 * (a2 * d4 - a4 * d2) + d1 * (a2 * b4 - a4 * b2)) * scale; _m4storage[11] = - -(a1 * (b2 * c4 - b4 * c2) - - b1 * (a2 * c4 - a4 * c2) + - c1 * (a2 * b4 - a4 * b2)) * - scale; + -(a1 * (b2 * c4 - b4 * c2) - b1 * (a2 * c4 - a4 * c2) + c1 * (a2 * b4 - a4 * b2)) * scale; _m4storage[12] = - -(b1 * (c2 * d3 - c3 * d2) - - c1 * (b2 * d3 - b3 * d2) + - d1 * (b2 * c3 - b3 * c2)) * - scale; + -(b1 * (c2 * d3 - c3 * d2) - c1 * (b2 * d3 - b3 * d2) + d1 * (b2 * c3 - b3 * c2)) * scale; _m4storage[13] = - (a1 * (c2 * d3 - c3 * d2) - - c1 * (a2 * d3 - a3 * d2) + - d1 * (a2 * c3 - a3 * c2)) * - scale; + (a1 * (c2 * d3 - c3 * d2) - c1 * (a2 * d3 - a3 * d2) + d1 * (a2 * c3 - a3 * c2)) * scale; _m4storage[14] = - -(a1 * (b2 * d3 - b3 * d2) - - b1 * (a2 * d3 - a3 * d2) + - d1 * (a2 * b3 - a3 * b2)) * - scale; + -(a1 * (b2 * d3 - b3 * d2) - b1 * (a2 * d3 - a3 * d2) + d1 * (a2 * b3 - a3 * b2)) * scale; _m4storage[15] = - (a1 * (b2 * c3 - b3 * c2) - - b1 * (a2 * c3 - a3 * c2) + - c1 * (a2 * b3 - a3 * b2)) * - scale; + (a1 * (b2 * c3 - b3 * c2) - b1 * (a2 * c3 - a3 * c2) + c1 * (a2 * b3 - a3 * b2)) * scale; } /// Rotates [arg] by the absolute rotation of this @@ -2054,12 +1927,9 @@ class Matrix4 { /// Decomposes this into [translation], [rotation] and [scale] components. void decompose(Vector3 translation, Quaternion rotation, Vector3 scale) { final Vector3 v = _decomposeV ??= Vector3.zero(); - double sx = - (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length; - final double sy = - (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length; - final double sz = - (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length; + double sx = (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length; + final double sy = (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length; + final double sz = (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length; if (determinant() < 0) { sx = -sx; diff --git a/packages/vector_math/lib/src/vector_math/obb3.dart b/packages/vector_math/lib/src/vector_math/obb3.dart index 1ca01d8..b683dde 100644 --- a/packages/vector_math/lib/src/vector_math/obb3.dart +++ b/packages/vector_math/lib/src/vector_math/obb3.dart @@ -242,110 +242,71 @@ class Obb3 { _halfExtents[2] * _absR.entry(2, i); rb = other._halfExtents[i]; - if ((_t[0] * _r.entry(0, i) + - _t[1] * _r.entry(1, i) + - _t[2] * _r.entry(2, i)) - .abs() > + if ((_t[0] * _r.entry(0, i) + _t[1] * _r.entry(1, i) + _t[2] * _r.entry(2, i)).abs() > ra + rb) { return false; } } // Test axis L = A0 x B0 - ra = - _halfExtents[1] * _absR.entry(2, 0) + - _halfExtents[2] * _absR.entry(1, 0); - rb = - other._halfExtents[1] * _absR.entry(0, 2) + - other._halfExtents[2] * _absR.entry(0, 1); + ra = _halfExtents[1] * _absR.entry(2, 0) + _halfExtents[2] * _absR.entry(1, 0); + rb = other._halfExtents[1] * _absR.entry(0, 2) + other._halfExtents[2] * _absR.entry(0, 1); if ((_t[2] * _r.entry(1, 0) - _t[1] * _r.entry(2, 0)).abs() > ra + rb) { return false; } // Test axis L = A0 x B1 - ra = - _halfExtents[1] * _absR.entry(2, 1) + - _halfExtents[2] * _absR.entry(1, 1); - rb = - other._halfExtents[0] * _absR.entry(0, 2) + - other._halfExtents[2] * _absR.entry(0, 0); + ra = _halfExtents[1] * _absR.entry(2, 1) + _halfExtents[2] * _absR.entry(1, 1); + rb = other._halfExtents[0] * _absR.entry(0, 2) + other._halfExtents[2] * _absR.entry(0, 0); if ((_t[2] * _r.entry(1, 1) - _t[1] * _r.entry(2, 1)).abs() > ra + rb) { return false; } // Test axis L = A0 x B2 - ra = - _halfExtents[1] * _absR.entry(2, 2) + - _halfExtents[2] * _absR.entry(1, 2); - rb = - other._halfExtents[0] * _absR.entry(0, 1) + - other._halfExtents[1] * _absR.entry(0, 0); + ra = _halfExtents[1] * _absR.entry(2, 2) + _halfExtents[2] * _absR.entry(1, 2); + rb = other._halfExtents[0] * _absR.entry(0, 1) + other._halfExtents[1] * _absR.entry(0, 0); if ((_t[2] * _r.entry(1, 2) - _t[1] * _r.entry(2, 2)).abs() > ra + rb) { return false; } // Test axis L = A1 x B0 - ra = - _halfExtents[0] * _absR.entry(2, 0) + - _halfExtents[2] * _absR.entry(0, 0); - rb = - other._halfExtents[1] * _absR.entry(1, 2) + - other._halfExtents[2] * _absR.entry(1, 1); + ra = _halfExtents[0] * _absR.entry(2, 0) + _halfExtents[2] * _absR.entry(0, 0); + rb = other._halfExtents[1] * _absR.entry(1, 2) + other._halfExtents[2] * _absR.entry(1, 1); if ((_t[0] * _r.entry(2, 0) - _t[2] * _r.entry(0, 0)).abs() > ra + rb) { return false; } // Test axis L = A1 x B1 - ra = - _halfExtents[0] * _absR.entry(2, 1) + - _halfExtents[2] * _absR.entry(0, 1); - rb = - other._halfExtents[0] * _absR.entry(1, 2) + - other._halfExtents[2] * _absR.entry(1, 0); + ra = _halfExtents[0] * _absR.entry(2, 1) + _halfExtents[2] * _absR.entry(0, 1); + rb = other._halfExtents[0] * _absR.entry(1, 2) + other._halfExtents[2] * _absR.entry(1, 0); if ((_t[0] * _r.entry(2, 1) - _t[2] * _r.entry(0, 1)).abs() > ra + rb) { return false; } // Test axis L = A1 x B2 - ra = - _halfExtents[0] * _absR.entry(2, 2) + - _halfExtents[2] * _absR.entry(0, 2); - rb = - other._halfExtents[0] * _absR.entry(1, 1) + - other._halfExtents[1] * _absR.entry(1, 0); + ra = _halfExtents[0] * _absR.entry(2, 2) + _halfExtents[2] * _absR.entry(0, 2); + rb = other._halfExtents[0] * _absR.entry(1, 1) + other._halfExtents[1] * _absR.entry(1, 0); if ((_t[0] * _r.entry(2, 2) - _t[2] * _r.entry(0, 2)).abs() > ra + rb) { return false; } // Test axis L = A2 x B0 - ra = - _halfExtents[0] * _absR.entry(1, 0) + - _halfExtents[1] * _absR.entry(0, 0); - rb = - other._halfExtents[1] * _absR.entry(2, 2) + - other._halfExtents[2] * _absR.entry(2, 1); + ra = _halfExtents[0] * _absR.entry(1, 0) + _halfExtents[1] * _absR.entry(0, 0); + rb = other._halfExtents[1] * _absR.entry(2, 2) + other._halfExtents[2] * _absR.entry(2, 1); if ((_t[1] * _r.entry(0, 0) - _t[0] * _r.entry(1, 0)).abs() > ra + rb) { return false; } // Test axis L = A2 x B1 - ra = - _halfExtents[0] * _absR.entry(1, 1) + - _halfExtents[1] * _absR.entry(0, 1); - rb = - other._halfExtents[0] * _absR.entry(2, 2) + - other._halfExtents[2] * _absR.entry(2, 0); + ra = _halfExtents[0] * _absR.entry(1, 1) + _halfExtents[1] * _absR.entry(0, 1); + rb = other._halfExtents[0] * _absR.entry(2, 2) + other._halfExtents[2] * _absR.entry(2, 0); if ((_t[1] * _r.entry(0, 1) - _t[0] * _r.entry(1, 1)).abs() > ra + rb) { return false; } // Test axis L = A2 x B2 - ra = - _halfExtents[0] * _absR.entry(1, 2) + - _halfExtents[1] * _absR.entry(0, 2); - rb = - other._halfExtents[0] * _absR.entry(2, 1) + - other._halfExtents[1] * _absR.entry(2, 0); + ra = _halfExtents[0] * _absR.entry(1, 2) + _halfExtents[1] * _absR.entry(0, 2); + rb = other._halfExtents[0] * _absR.entry(2, 1) + other._halfExtents[1] * _absR.entry(2, 0); if ((_t[1] * _r.entry(0, 2) - _t[0] * _r.entry(1, 2)).abs() > ra + rb) { return false; } diff --git a/packages/vector_math/lib/src/vector_math/opengl.dart b/packages/vector_math/lib/src/vector_math/opengl.dart index c837cb4..854d2b4 100644 --- a/packages/vector_math/lib/src/vector_math/opengl.dart +++ b/packages/vector_math/lib/src/vector_math/opengl.dart @@ -40,11 +40,7 @@ part of '../../vector_math.dart'; /// gl.uniformMatrix4fv(u_MV, false, _MV.storage); /// } /// } -void setRotationMatrix( - Matrix4 rotationMatrix, - Vector3 forwardDirection, - Vector3 upDirection, -) { +void setRotationMatrix(Matrix4 rotationMatrix, Vector3 forwardDirection, Vector3 upDirection) { setModelMatrix(rotationMatrix, forwardDirection, upDirection, 0.0, 0.0, 0.0); } @@ -136,11 +132,7 @@ void setViewMatrix( /// [cameraPosition] specifies the position of the camera. /// [cameraFocusPosition] specifies the position the camera is focused on. /// [upDirection] specifies the direction of the up vector (usually, +Y). -Matrix4 makeViewMatrix( - Vector3 cameraPosition, - Vector3 cameraFocusPosition, - Vector3 upDirection, -) { +Matrix4 makeViewMatrix(Vector3 cameraPosition, Vector3 cameraFocusPosition, Vector3 upDirection) { final r = Matrix4.zero(); setViewMatrix(r, cameraPosition, cameraFocusPosition, upDirection); return r; @@ -186,12 +178,7 @@ void setPerspectiveMatrix( /// (always positive). /// [zFar] specifies the distance from the viewer to the far plane /// (always positive). -Matrix4 makePerspectiveMatrix( - double fovYRadians, - double aspectRatio, - double zNear, - double zFar, -) { +Matrix4 makePerspectiveMatrix(double fovYRadians, double aspectRatio, double zNear, double zFar) { final r = Matrix4.zero(); setPerspectiveMatrix(r, fovYRadians, aspectRatio, zNear, zFar); return r; @@ -230,11 +217,7 @@ void setInfiniteMatrix( /// in the x direction. The aspect ratio of x (width) to y (height). /// [zNear] specifies the distance from the viewer to the near plane /// (always positive). -Matrix4 makeInfiniteMatrix( - double fovYRadians, - double aspectRatio, - double zNear, -) { +Matrix4 makeInfiniteMatrix(double fovYRadians, double aspectRatio, double zNear) { final r = Matrix4.zero(); setInfiniteMatrix(r, fovYRadians, aspectRatio, zNear); return r; @@ -351,24 +334,12 @@ Matrix4 makeOrthographicMatrix( /// Returns a transformation matrix that transforms points onto /// the plane specified with [planeNormal] and [planePoint]. Matrix4 makePlaneProjection(Vector3 planeNormal, Vector3 planePoint) { - final v = Vector4( - planeNormal.storage[0], - planeNormal.storage[1], - planeNormal.storage[2], - 0.0, - ); + final v = Vector4(planeNormal.storage[0], planeNormal.storage[1], planeNormal.storage[2], 0.0); final outer = Matrix4.outer(v, v); var r = Matrix4.zero(); r = r - outer; - final Vector3 scaledNormal = planeNormal.scaled( - dot3(planePoint, planeNormal), - ); - final T = Vector4( - scaledNormal.storage[0], - scaledNormal.storage[1], - scaledNormal.storage[2], - 1.0, - ); + final Vector3 scaledNormal = planeNormal.scaled(dot3(planePoint, planeNormal)); + final T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1], scaledNormal.storage[2], 1.0); r.setColumn(3, T); return r; } @@ -376,23 +347,13 @@ Matrix4 makePlaneProjection(Vector3 planeNormal, Vector3 planePoint) { /// Returns a transformation matrix that transforms points by reflecting /// them through the plane specified with [planeNormal] and [planePoint]. Matrix4 makePlaneReflection(Vector3 planeNormal, Vector3 planePoint) { - final v = Vector4( - planeNormal.storage[0], - planeNormal.storage[1], - planeNormal.storage[2], - 0.0, - ); + final v = Vector4(planeNormal.storage[0], planeNormal.storage[1], planeNormal.storage[2], 0.0); final outer = Matrix4.outer(v, v)..scaleByDouble(2.0, 2.0, 2.0, 1.0); var r = Matrix4.zero(); r = r - outer; final double scale = 2.0 * planePoint.dot(planeNormal); final Vector3 scaledNormal = planeNormal.scaled(scale); - final T = Vector4( - scaledNormal.storage[0], - scaledNormal.storage[1], - scaledNormal.storage[2], - 1.0, - ); + final T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1], scaledNormal.storage[2], 1.0); r.setColumn(3, T); return r; } @@ -432,12 +393,7 @@ bool unproject( pickZ = (2.0 * pickZ) - 1.0; // Check if pick point is inside unit cube - if (pickX < -1.0 || - pickY < -1.0 || - pickX > 1.0 || - pickY > 1.0 || - pickZ < -1.0 || - pickZ > 1.0) { + if (pickX < -1.0 || pickY < -1.0 || pickX > 1.0 || pickY > 1.0 || pickZ < -1.0 || pickZ > 1.0) { return false; } diff --git a/packages/vector_math/lib/src/vector_math/plane.dart b/packages/vector_math/lib/src/vector_math/plane.dart index 74b9fe1..a197ce1 100644 --- a/packages/vector_math/lib/src/vector_math/plane.dart +++ b/packages/vector_math/lib/src/vector_math/plane.dart @@ -11,15 +11,11 @@ part of '../../vector_math.dart'; class Plane { Plane() : _normal = Vector3.zero(), constant = 0.0; - Plane.copy(Plane other) - : _normal = Vector3.copy(other._normal), - constant = other.constant; + Plane.copy(Plane other) : _normal = Vector3.copy(other._normal), constant = other.constant; - Plane.components(double x, double y, double z, this.constant) - : _normal = Vector3(x, y, z); + Plane.components(double x, double y, double z, this.constant) : _normal = Vector3(x, y, z); - Plane.normalconstant(Vector3 normal_, this.constant) - : _normal = Vector3.copy(normal_); + Plane.normalconstant(Vector3 normal_, this.constant) : _normal = Vector3.copy(normal_); final Vector3 _normal; double constant; diff --git a/packages/vector_math/lib/src/vector_math/quaternion.dart b/packages/vector_math/lib/src/vector_math/quaternion.dart index 3e9890a..3a1c9c9 100644 --- a/packages/vector_math/lib/src/vector_math/quaternion.dart +++ b/packages/vector_math/lib/src/vector_math/quaternion.dart @@ -30,8 +30,7 @@ class Quaternion { Quaternion._()..setFromTwoVectors(a, b); /// Constructs a quaternion as a copy of [original]. - factory Quaternion.copy(Quaternion original) => - Quaternion._()..setFrom(original); + factory Quaternion.copy(Quaternion original) => Quaternion._()..setFrom(original); /// Constructs a quaternion with a random rotation. The random number /// generator [rn] is used to generate the random numbers for the rotation. @@ -42,8 +41,7 @@ class Quaternion { /// Constructs a quaternion from time derivative of [q] with angular /// velocity [omega]. - factory Quaternion.dq(Quaternion q, Vector3 omega) => - Quaternion._()..setDQ(q, omega); + factory Quaternion.dq(Quaternion q, Vector3 omega) => Quaternion._()..setDQ(q, omega); /// Constructs a quaternion from [yaw], [pitch] and [roll]. factory Quaternion.euler(double yaw, double pitch, double roll) => @@ -315,11 +313,7 @@ class Quaternion { } final double scale = 1.0 / math.sqrt(den); - return Vector3( - _qStorage[0] * scale, - _qStorage[1] * scale, - _qStorage[2] * scale, - ); + return Vector3(_qStorage[0] * scale, _qStorage[1] * scale, _qStorage[2] * scale); } /// Length squared. diff --git a/packages/vector_math/lib/src/vector_math/sphere.dart b/packages/vector_math/lib/src/vector_math/sphere.dart index 9fac298..7706c05 100644 --- a/packages/vector_math/lib/src/vector_math/sphere.dart +++ b/packages/vector_math/lib/src/vector_math/sphere.dart @@ -10,13 +10,10 @@ class Sphere { Sphere() : _center = Vector3.zero(), radius = 0.0; /// Create a sphere as a copy of [other]. - Sphere.copy(Sphere other) - : _center = Vector3.copy(other._center), - radius = other.radius; + Sphere.copy(Sphere other) : _center = Vector3.copy(other._center), radius = other.radius; /// Create a sphere from a [center] and a [radius]. - Sphere.centerRadius(Vector3 center, this.radius) - : _center = Vector3.copy(center); + Sphere.centerRadius(Vector3 center, this.radius) : _center = Vector3.copy(center); final Vector3 _center; /// The [radius] of the sphere. @@ -32,12 +29,10 @@ class Sphere { } /// Return if this contains [other]. - bool containsVector3(Vector3 other) => - other.distanceToSquared(center) < radius * radius; + bool containsVector3(Vector3 other) => other.distanceToSquared(center) < radius * radius; /// Return if this intersects with [other]. - bool intersectsWithVector3(Vector3 other) => - other.distanceToSquared(center) <= radius * radius; + bool intersectsWithVector3(Vector3 other) => other.distanceToSquared(center) <= radius * radius; /// Return if this intersects with [other]. bool intersectsWithSphere(Sphere other) { diff --git a/packages/vector_math/lib/src/vector_math/triangle.dart b/packages/vector_math/lib/src/vector_math/triangle.dart index 317c258..6451ba6 100644 --- a/packages/vector_math/lib/src/vector_math/triangle.dart +++ b/packages/vector_math/lib/src/vector_math/triangle.dart @@ -7,10 +7,7 @@ part of '../../vector_math.dart'; /// Defines a triangle by three points. class Triangle { /// Create a new, uninitialized triangle. - Triangle() - : _point0 = Vector3.zero(), - _point1 = Vector3.zero(), - _point2 = Vector3.zero(); + Triangle() : _point0 = Vector3.zero(), _point1 = Vector3.zero(), _point2 = Vector3.zero(); /// Create a triangle as a copy of [other]. Triangle.copy(Triangle other) diff --git a/packages/vector_math/lib/src/vector_math/utilities.dart b/packages/vector_math/lib/src/vector_math/utilities.dart index 560bcee..736b761 100644 --- a/packages/vector_math/lib/src/vector_math/utilities.dart +++ b/packages/vector_math/lib/src/vector_math/utilities.dart @@ -25,16 +25,9 @@ double smoothStep(double edge0, double edge1, double amount) { /// Do a catmull rom spline interpolation with [edge0], [edge1], [edge2] and /// [edge3] by [amount]. -double catmullRom( - double edge0, - double edge1, - double edge2, - double edge3, - double amount, -) => +double catmullRom(double edge0, double edge1, double edge2, double edge3, double amount) => 0.5 * ((2.0 * edge1) + (-edge0 + edge2) * amount + (2.0 * edge0 - 5.0 * edge1 + 4.0 * edge2 - edge3) * (amount * amount) + - (-edge0 + 3.0 * edge1 - 3.0 * edge2 + edge3) * - (amount * amount * amount)); + (-edge0 + 3.0 * edge1 - 3.0 * edge2 + edge3) * (amount * amount * amount)); diff --git a/packages/vector_math/lib/src/vector_math/vector.dart b/packages/vector_math/lib/src/vector_math/vector.dart index 1be1fd3..6c90c37 100644 --- a/packages/vector_math/lib/src/vector_math/vector.dart +++ b/packages/vector_math/lib/src/vector_math/vector.dart @@ -39,8 +39,7 @@ void cross2B(Vector2 x, double y, Vector2 out) { void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { if (planeNormal.z.abs() > math.sqrt1_2) { // choose u in y-z plane - final double a = - planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; + final double a = planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; final double k = 1.0 / math.sqrt(a); u ..x = 0.0 @@ -53,8 +52,7 @@ void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { ..z = planeNormal[0] * (-planeNormal[2] * k); } else { // choose u in x-y plane - final double a = - planeNormal.x * planeNormal.x + planeNormal.y * planeNormal.y; + final double a = planeNormal.x * planeNormal.x + planeNormal.y * planeNormal.y; final double k = 1.0 / math.sqrt(a); u ..x = -planeNormal[1] * k diff --git a/packages/vector_math/lib/src/vector_math/vector2.dart b/packages/vector_math/lib/src/vector_math/vector2.dart index 5df6635..5e4a3c1 100644 --- a/packages/vector_math/lib/src/vector_math/vector2.dart +++ b/packages/vector_math/lib/src/vector_math/vector2.dart @@ -151,8 +151,7 @@ class Vector2 implements Vector { double get length => math.sqrt(length2); /// The squared length of the vector. - double get length2 => - _v2storage[1] * _v2storage[1] + _v2storage[0] * _v2storage[0]; + double get length2 => _v2storage[1] * _v2storage[1] + _v2storage[0] * _v2storage[0]; /// Normalize this. double normalize() { @@ -261,8 +260,7 @@ class Vector2 implements Vector { Vector2 reflected(Vector2 normal) => clone()..reflect(normal); /// Relative error between this and [correct] - double relativeError(Vector2 correct) => - absoluteError(correct) / correct.length; + double relativeError(Vector2 correct) => absoluteError(correct) / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector2 correct) { @@ -432,38 +430,22 @@ class Vector2 implements Vector { Vector3 get yxy => Vector3(_v2storage[1], _v2storage[0], _v2storage[1]); Vector3 get yyx => Vector3(_v2storage[1], _v2storage[1], _v2storage[0]); Vector3 get yyy => Vector3(_v2storage[1], _v2storage[1], _v2storage[1]); - Vector4 get xxxx => - Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[0]); - Vector4 get xxxy => - Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[1]); - Vector4 get xxyx => - Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[0]); - Vector4 get xxyy => - Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[1]); - Vector4 get xyxx => - Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[0]); - Vector4 get xyxy => - Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[1]); - Vector4 get xyyx => - Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[0]); - Vector4 get xyyy => - Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[1]); - Vector4 get yxxx => - Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[0]); - Vector4 get yxxy => - Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[1]); - Vector4 get yxyx => - Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[0]); - Vector4 get yxyy => - Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[1]); - Vector4 get yyxx => - Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[0]); - Vector4 get yyxy => - Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[1]); - Vector4 get yyyx => - Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[0]); - Vector4 get yyyy => - Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[1]); + Vector4 get xxxx => Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[0]); + Vector4 get xxxy => Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[1]); + Vector4 get xxyx => Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[0]); + Vector4 get xxyy => Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[1]); + Vector4 get xyxx => Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[0]); + Vector4 get xyxy => Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[1]); + Vector4 get xyyx => Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[0]); + Vector4 get xyyy => Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[1]); + Vector4 get yxxx => Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[0]); + Vector4 get yxxy => Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[1]); + Vector4 get yxyx => Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[0]); + Vector4 get yxyy => Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[1]); + Vector4 get yyxx => Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[0]); + Vector4 get yyxy => Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[1]); + Vector4 get yyyx => Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[0]); + Vector4 get yyyy => Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[1]); double get r => x; double get g => y; double get s => x; diff --git a/packages/vector_math/lib/src/vector_math/vector3.dart b/packages/vector_math/lib/src/vector_math/vector3.dart index 988f3c3..2fcad23 100644 --- a/packages/vector_math/lib/src/vector_math/vector3.dart +++ b/packages/vector_math/lib/src/vector_math/vector3.dart @@ -10,8 +10,7 @@ part of '../../vector_math.dart'; /// 3D column vector. class Vector3 implements Vector { /// Construct a new vector with the specified values. - factory Vector3(double x, double y, double z) => - Vector3.zero()..setValues(x, y, z); + factory Vector3(double x, double y, double z) => Vector3.zero()..setValues(x, y, z); /// Initialized with values from [array] starting at [offset]. factory Vector3.array(List array, [int offset = 0]) => @@ -253,12 +252,9 @@ class Vector3 implements Vector { final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - v0 * argStorage[6] + v1 * argStorage[7] + v2 * argStorage[8]; - _v3storage[1] = - v0 * argStorage[3] + v1 * argStorage[4] + v2 * argStorage[5]; - _v3storage[0] = - v0 * argStorage[0] + v1 * argStorage[1] + v2 * argStorage[2]; + _v3storage[2] = v0 * argStorage[6] + v1 * argStorage[7] + v2 * argStorage[8]; + _v3storage[1] = v0 * argStorage[3] + v1 * argStorage[4] + v2 * argStorage[5]; + _v3storage[0] = v0 * argStorage[0] + v1 * argStorage[1] + v2 * argStorage[2]; } /// Cross product. @@ -307,29 +303,13 @@ class Vector3 implements Vector { final double y = _v3storage[1]; final double x = _v3storage[0]; final double d = - 1.0 / - (argStorage[15] + - argStorage[11] * z + - argStorage[7] * y + - argStorage[3] * x); + 1.0 / (argStorage[15] + argStorage[11] * z + argStorage[7] * y + argStorage[3] * x); _v3storage[0] = - (argStorage[12] + - argStorage[8] * z + - argStorage[4] * y + - argStorage[0] * x) * - d; + (argStorage[12] + argStorage[8] * z + argStorage[4] * y + argStorage[0] * x) * d; _v3storage[1] = - (argStorage[13] + - argStorage[9] * z + - argStorage[5] * y + - argStorage[1] * x) * - d; + (argStorage[13] + argStorage[9] * z + argStorage[5] * y + argStorage[1] * x) * d; _v3storage[2] = - (argStorage[14] + - argStorage[10] * z + - argStorage[6] * y + - argStorage[2] * x) * - d; + (argStorage[14] + argStorage[10] * z + argStorage[6] * y + argStorage[2] * x) * d; } /// Applies a rotation specified by [axis] and [angle]. @@ -362,12 +342,9 @@ class Vector3 implements Vector { final double v2 = _v3storage[2]; final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - argStorage[2] * v0 + argStorage[5] * v1 + argStorage[8] * v2; - _v3storage[1] = - argStorage[1] * v0 + argStorage[4] * v1 + argStorage[7] * v2; - _v3storage[0] = - argStorage[0] * v0 + argStorage[3] * v1 + argStorage[6] * v2; + _v3storage[2] = argStorage[2] * v0 + argStorage[5] * v1 + argStorage[8] * v2; + _v3storage[1] = argStorage[1] * v0 + argStorage[4] * v1 + argStorage[7] * v2; + _v3storage[0] = argStorage[0] * v0 + argStorage[3] * v1 + argStorage[6] * v2; } /// Multiplies this by a 4x3 subset of [arg]. Expects [arg] to be an affine @@ -377,26 +354,13 @@ class Vector3 implements Vector { final double v2 = _v3storage[2]; final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - argStorage[2] * v0 + - argStorage[6] * v1 + - argStorage[10] * v2 + - argStorage[14]; - _v3storage[1] = - argStorage[1] * v0 + - argStorage[5] * v1 + - argStorage[9] * v2 + - argStorage[13]; - _v3storage[0] = - argStorage[0] * v0 + - argStorage[4] * v1 + - argStorage[8] * v2 + - argStorage[12]; + _v3storage[2] = argStorage[2] * v0 + argStorage[6] * v1 + argStorage[10] * v2 + argStorage[14]; + _v3storage[1] = argStorage[1] * v0 + argStorage[5] * v1 + argStorage[9] * v2 + argStorage[13]; + _v3storage[0] = argStorage[0] * v0 + argStorage[4] * v1 + argStorage[8] * v2 + argStorage[12]; } /// Relative error between this and [correct] - double relativeError(Vector3 correct) => - absoluteError(correct) / correct.length; + double relativeError(Vector3 correct) => absoluteError(correct) / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector3 correct) { @@ -408,13 +372,10 @@ class Vector3 implements Vector { /// True if any component is infinite. bool get isInfinite => - _v3storage[2].isInfinite || - _v3storage[1].isInfinite || - _v3storage[0].isInfinite; + _v3storage[2].isInfinite || _v3storage[1].isInfinite || _v3storage[0].isInfinite; /// True if any component is NaN. - bool get isNaN => - _v3storage[2].isNaN || _v3storage[1].isNaN || _v3storage[0].isNaN; + bool get isNaN => _v3storage[2].isNaN || _v3storage[1].isNaN || _v3storage[0].isNaN; /// Add [arg] to this. void add(Vector3 arg) { @@ -703,168 +664,87 @@ class Vector3 implements Vector { Vector3 get zzx => Vector3(_v3storage[2], _v3storage[2], _v3storage[0]); Vector3 get zzy => Vector3(_v3storage[2], _v3storage[2], _v3storage[1]); Vector3 get zzz => Vector3(_v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get xxxx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get xxxy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get xxxz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get xxyx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get xxyy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get xxyz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get xxzx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get xxzy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get xxzz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get xyxx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get xyxy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get xyxz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get xyyx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get xyyy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get xyyz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get xyzx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get xyzy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get xyzz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get xzxx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get xzxy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get xzxz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get xzyx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get xzyy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get xzyz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get xzzx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get xzzy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get xzzz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get yxxx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get yxxy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get yxxz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get yxyx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get yxyy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get yxyz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get yxzx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get yxzy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get yxzz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get yyxx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get yyxy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get yyxz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get yyyx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get yyyy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get yyyz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get yyzx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get yyzy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get yyzz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get yzxx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get yzxy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get yzxz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get yzyx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get yzyy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get yzyz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get yzzx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get yzzy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get yzzz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get zxxx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get zxxy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get zxxz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get zxyx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get zxyy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get zxyz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get zxzx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get zxzy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get zxzz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get zyxx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get zyxy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get zyxz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get zyyx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get zyyy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get zyyz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get zyzx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get zyzy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get zyzz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get zzxx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get zzxy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get zzxz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get zzyx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get zzyy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get zzyz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get zzzx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get zzzy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get zzzz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get xxxx => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get xxxy => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get xxxz => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get xxyx => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get xxyy => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get xxyz => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get xxzx => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get xxzy => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get xxzz => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get xyxx => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get xyxy => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get xyxz => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get xyyx => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get xyyy => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get xyyz => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get xyzx => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get xyzy => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get xyzz => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get xzxx => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get xzxy => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get xzxz => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get xzyx => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get xzyy => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get xzyz => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get xzzx => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get xzzy => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get xzzz => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get yxxx => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get yxxy => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get yxxz => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get yxyx => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get yxyy => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get yxyz => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get yxzx => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get yxzy => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get yxzz => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get yyxx => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get yyxy => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get yyxz => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get yyyx => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get yyyy => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get yyyz => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get yyzx => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get yyzy => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get yyzz => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get yzxx => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get yzxy => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get yzxz => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get yzyx => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get yzyy => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get yzyz => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get yzzx => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get yzzy => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get yzzz => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get zxxx => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get zxxy => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get zxxz => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get zxyx => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get zxyy => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get zxyz => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get zxzx => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get zxzy => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get zxzz => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get zyxx => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get zyxy => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get zyxz => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get zyyx => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get zyyy => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get zyyz => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get zyzx => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get zyzy => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get zyzz => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get zzxx => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get zzxy => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get zzxz => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get zzyx => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get zzyy => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get zzyz => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get zzzx => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get zzzy => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get zzzz => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[2]); double get r => x; double get g => y; double get b => z; diff --git a/packages/vector_math/lib/src/vector_math/vector4.dart b/packages/vector_math/lib/src/vector_math/vector4.dart index 414fa53..599e089 100644 --- a/packages/vector_math/lib/src/vector_math/vector4.dart +++ b/packages/vector_math/lib/src/vector_math/vector4.dart @@ -10,8 +10,7 @@ part of '../../vector_math.dart'; /// 4D column vector. class Vector4 implements Vector { /// Construct a new vector with the specified values. - factory Vector4(double x, double y, double z, double w) => - Vector4.zero()..setValues(x, y, z, w); + factory Vector4(double x, double y, double z, double w) => Vector4.zero()..setValues(x, y, z, w); /// Initialized with values from [array] starting at [offset]. factory Vector4.array(List array, [int offset = 0]) => @@ -41,12 +40,7 @@ class Vector4 implements Vector { /// optionally pass your own random number generator. factory Vector4.random([math.Random? rng]) { rng ??= math.Random(); - return Vector4( - rng.nextDouble(), - rng.nextDouble(), - rng.nextDouble(), - rng.nextDouble(), - ); + return Vector4(rng.nextDouble(), rng.nextDouble(), rng.nextDouble(), rng.nextDouble()); } final Float32List _v4storage; @@ -254,30 +248,17 @@ class Vector4 implements Vector { final double v1 = _v4storage[0]; final Float32List argStorage = arg._m4storage; _v4storage[3] = - argStorage[3] * v1 + - argStorage[7] * v2 + - argStorage[11] * v3 + - argStorage[15] * v4; + argStorage[3] * v1 + argStorage[7] * v2 + argStorage[11] * v3 + argStorage[15] * v4; _v4storage[2] = - argStorage[2] * v1 + - argStorage[6] * v2 + - argStorage[10] * v3 + - argStorage[14] * v4; + argStorage[2] * v1 + argStorage[6] * v2 + argStorage[10] * v3 + argStorage[14] * v4; _v4storage[1] = - argStorage[1] * v1 + - argStorage[5] * v2 + - argStorage[9] * v3 + - argStorage[13] * v4; + argStorage[1] * v1 + argStorage[5] * v2 + argStorage[9] * v3 + argStorage[13] * v4; _v4storage[0] = - argStorage[0] * v1 + - argStorage[4] * v2 + - argStorage[8] * v3 + - argStorage[12] * v4; + argStorage[0] * v1 + argStorage[4] * v2 + argStorage[8] * v3 + argStorage[12] * v4; } /// Relative error between this and [correct] - double relativeError(Vector4 correct) => - (this - correct).length / correct.length; + double relativeError(Vector4 correct) => (this - correct).length / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector4 correct) { @@ -285,9 +266,7 @@ class Vector4 implements Vector { final double zDiff = _v4storage[2] - correct._v4storage[2]; final double yDiff = _v4storage[1] - correct._v4storage[1]; final double xDiff = _v4storage[0] - correct._v4storage[0]; - return math.sqrt( - xDiff * xDiff + yDiff * yDiff + zDiff * zDiff + wDiff * wDiff, - ); + return math.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff + wDiff * wDiff); } /// True if any component is infinite. @@ -299,10 +278,7 @@ class Vector4 implements Vector { /// True if any component is NaN. bool get isNaN => - _v4storage[3].isNaN || - _v4storage[2].isNaN || - _v4storage[1].isNaN || - _v4storage[0].isNaN; + _v4storage[3].isNaN || _v4storage[2].isNaN || _v4storage[1].isNaN || _v4storage[0].isNaN; void add(Vector4 arg) { final Float32List argStorage = arg._v4storage; @@ -1106,518 +1082,262 @@ class Vector4 implements Vector { Vector3 get wwy => Vector3(_v4storage[3], _v4storage[3], _v4storage[1]); Vector3 get wwz => Vector3(_v4storage[3], _v4storage[3], _v4storage[2]); Vector3 get www => Vector3(_v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get xxxx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get xxxy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get xxxz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get xxxw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get xxyx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get xxyy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get xxyz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get xxyw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get xxzx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get xxzy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get xxzz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get xxzw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get xxwx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get xxwy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get xxwz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get xxww => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get xyxx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get xyxy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get xyxz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get xyxw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get xyyx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get xyyy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get xyyz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get xyyw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get xyzx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get xyzy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get xyzz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get xyzw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get xywx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get xywy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get xywz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get xyww => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get xzxx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get xzxy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get xzxz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get xzxw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get xzyx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get xzyy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get xzyz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get xzyw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get xzzx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get xzzy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get xzzz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get xzzw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get xzwx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get xzwy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get xzwz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get xzww => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get xwxx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get xwxy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get xwxz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get xwxw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get xwyx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get xwyy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get xwyz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get xwyw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get xwzx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get xwzy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get xwzz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get xwzw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get xwwx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get xwwy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get xwwz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get xwww => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get yxxx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get yxxy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get yxxz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get yxxw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get yxyx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get yxyy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get yxyz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get yxyw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get yxzx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get yxzy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get yxzz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get yxzw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get yxwx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get yxwy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get yxwz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get yxww => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get yyxx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get yyxy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get yyxz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get yyxw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get yyyx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get yyyy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get yyyz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get yyyw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get yyzx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get yyzy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get yyzz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get yyzw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get yywx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get yywy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get yywz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get yyww => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get yzxx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get yzxy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get yzxz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get yzxw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get yzyx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get yzyy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get yzyz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get yzyw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get yzzx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get yzzy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get yzzz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get yzzw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get yzwx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get yzwy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get yzwz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get yzww => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get ywxx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get ywxy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get ywxz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get ywxw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get ywyx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get ywyy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get ywyz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get ywyw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get ywzx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get ywzy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get ywzz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get ywzw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get ywwx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get ywwy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get ywwz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get ywww => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get zxxx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get zxxy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get zxxz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get zxxw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get zxyx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get zxyy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get zxyz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get zxyw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get zxzx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get zxzy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get zxzz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get zxzw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get zxwx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get zxwy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get zxwz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get zxww => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get zyxx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get zyxy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get zyxz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get zyxw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get zyyx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get zyyy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get zyyz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get zyyw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get zyzx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get zyzy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get zyzz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get zyzw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get zywx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get zywy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get zywz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get zyww => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get zzxx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get zzxy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get zzxz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get zzxw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get zzyx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get zzyy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get zzyz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get zzyw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get zzzx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get zzzy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get zzzz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get zzzw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get zzwx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get zzwy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get zzwz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get zzww => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get zwxx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get zwxy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get zwxz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get zwxw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get zwyx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get zwyy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get zwyz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get zwyw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get zwzx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get zwzy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get zwzz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get zwzw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get zwwx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get zwwy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get zwwz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get zwww => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get wxxx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get wxxy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get wxxz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get wxxw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get wxyx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get wxyy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get wxyz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get wxyw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get wxzx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get wxzy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get wxzz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get wxzw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get wxwx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get wxwy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get wxwz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get wxww => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get wyxx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get wyxy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get wyxz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get wyxw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get wyyx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get wyyy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get wyyz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get wyyw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get wyzx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get wyzy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get wyzz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get wyzw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get wywx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get wywy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get wywz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get wyww => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get wzxx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get wzxy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get wzxz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get wzxw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get wzyx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get wzyy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get wzyz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get wzyw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get wzzx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get wzzy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get wzzz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get wzzw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get wzwx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get wzwy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get wzwz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get wzww => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get wwxx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get wwxy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get wwxz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get wwxw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get wwyx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get wwyy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get wwyz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get wwyw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get wwzx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get wwzy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get wwzz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get wwzw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get wwwx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get wwwy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get wwwz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get wwww => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get xxxx => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get xxxy => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get xxxz => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get xxxw => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get xxyx => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get xxyy => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get xxyz => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get xxyw => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get xxzx => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get xxzy => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get xxzz => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get xxzw => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get xxwx => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get xxwy => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get xxwz => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get xxww => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get xyxx => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get xyxy => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get xyxz => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get xyxw => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get xyyx => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get xyyy => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get xyyz => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get xyyw => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get xyzx => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get xyzy => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get xyzz => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get xyzw => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get xywx => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get xywy => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get xywz => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get xyww => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get xzxx => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get xzxy => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get xzxz => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get xzxw => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get xzyx => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get xzyy => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get xzyz => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get xzyw => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get xzzx => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get xzzy => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get xzzz => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get xzzw => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get xzwx => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get xzwy => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get xzwz => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get xzww => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get xwxx => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get xwxy => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get xwxz => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get xwxw => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get xwyx => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get xwyy => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get xwyz => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get xwyw => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get xwzx => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get xwzy => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get xwzz => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get xwzw => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get xwwx => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get xwwy => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get xwwz => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get xwww => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get yxxx => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get yxxy => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get yxxz => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get yxxw => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get yxyx => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get yxyy => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get yxyz => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get yxyw => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get yxzx => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get yxzy => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get yxzz => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get yxzw => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get yxwx => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get yxwy => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get yxwz => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get yxww => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get yyxx => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get yyxy => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get yyxz => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get yyxw => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get yyyx => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get yyyy => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get yyyz => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get yyyw => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get yyzx => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get yyzy => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get yyzz => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get yyzw => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get yywx => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get yywy => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get yywz => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get yyww => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get yzxx => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get yzxy => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get yzxz => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get yzxw => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get yzyx => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get yzyy => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get yzyz => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get yzyw => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get yzzx => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get yzzy => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get yzzz => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get yzzw => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get yzwx => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get yzwy => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get yzwz => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get yzww => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get ywxx => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get ywxy => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get ywxz => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get ywxw => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get ywyx => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get ywyy => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get ywyz => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get ywyw => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get ywzx => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get ywzy => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get ywzz => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get ywzw => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get ywwx => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get ywwy => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get ywwz => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get ywww => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get zxxx => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get zxxy => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get zxxz => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get zxxw => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get zxyx => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get zxyy => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get zxyz => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get zxyw => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get zxzx => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get zxzy => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get zxzz => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get zxzw => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get zxwx => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get zxwy => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get zxwz => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get zxww => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get zyxx => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get zyxy => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get zyxz => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get zyxw => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get zyyx => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get zyyy => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get zyyz => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get zyyw => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get zyzx => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get zyzy => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get zyzz => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get zyzw => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get zywx => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get zywy => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get zywz => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get zyww => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get zzxx => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get zzxy => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get zzxz => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get zzxw => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get zzyx => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get zzyy => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get zzyz => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get zzyw => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get zzzx => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get zzzy => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get zzzz => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get zzzw => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get zzwx => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get zzwy => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get zzwz => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get zzww => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get zwxx => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get zwxy => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get zwxz => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get zwxw => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get zwyx => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get zwyy => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get zwyz => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get zwyw => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get zwzx => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get zwzy => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get zwzz => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get zwzw => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get zwwx => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get zwwy => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get zwwz => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get zwww => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get wxxx => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get wxxy => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get wxxz => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get wxxw => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get wxyx => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get wxyy => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get wxyz => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get wxyw => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get wxzx => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get wxzy => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get wxzz => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get wxzw => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get wxwx => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get wxwy => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get wxwz => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get wxww => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get wyxx => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get wyxy => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get wyxz => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get wyxw => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get wyyx => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get wyyy => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get wyyz => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get wyyw => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get wyzx => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get wyzy => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get wyzz => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get wyzw => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get wywx => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get wywy => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get wywz => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get wyww => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get wzxx => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get wzxy => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get wzxz => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get wzxw => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get wzyx => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get wzyy => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get wzyz => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get wzyw => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get wzzx => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get wzzy => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get wzzz => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get wzzw => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get wzwx => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get wzwy => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get wzwz => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get wzww => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get wwxx => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get wwxy => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get wwxz => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get wwxw => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get wwyx => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get wwyy => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get wwyz => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get wwyw => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get wwzx => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get wwzy => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get wwzz => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get wwzw => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get wwwx => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get wwwy => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get wwwz => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get wwww => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[3]); double get r => x; double get g => y; double get b => z; diff --git a/packages/vector_math/lib/src/vector_math_64/aabb2.dart b/packages/vector_math/lib/src/vector_math_64/aabb2.dart index 5fb2087..a349ea7 100644 --- a/packages/vector_math/lib/src/vector_math_64/aabb2.dart +++ b/packages/vector_math/lib/src/vector_math_64/aabb2.dart @@ -11,14 +11,10 @@ class Aabb2 { Aabb2() : _min = Vector2.zero(), _max = Vector2.zero(); /// Create a new AABB as a copy of [other]. - Aabb2.copy(Aabb2 other) - : _min = Vector2.copy(other._min), - _max = Vector2.copy(other._max); + Aabb2.copy(Aabb2 other) : _min = Vector2.copy(other._min), _max = Vector2.copy(other._max); /// Create a new AABB with a [min] and [max]. - Aabb2.minMax(Vector2 min, Vector2 max) - : _min = Vector2.copy(min), - _max = Vector2.copy(max); + Aabb2.minMax(Vector2 min, Vector2 max) : _min = Vector2.copy(min), _max = Vector2.copy(max); /// Create a new AABB with a [center] and [halfExtents]. factory Aabb2.centerAndHalfExtents(Vector2 center, Vector2 halfExtents) => @@ -29,10 +25,7 @@ class Aabb2 { /// [Float64List.bytesPerElement]. Aabb2.fromBuffer(ByteBuffer buffer, int offset) : _min = Vector2.fromBuffer(buffer, offset), - _max = Vector2.fromBuffer( - buffer, - offset + Float64List.bytesPerElement * 2, - ); + _max = Vector2.fromBuffer(buffer, offset + Float64List.bytesPerElement * 2); final Vector2 _min; final Vector2 _max; @@ -77,8 +70,7 @@ class Aabb2 { static final _center = Vector2.zero(); static final _halfExtents = Vector2.zero(); - void _updateCenterAndHalfExtents() => - copyCenterAndHalfExtents(_center, _halfExtents); + void _updateCenterAndHalfExtents() => copyCenterAndHalfExtents(_center, _halfExtents); /// Transform this by the transform [t]. void transform(Matrix3 t) { @@ -144,10 +136,7 @@ class Aabb2 { /// Return if this contains [other]. bool containsVector2(Vector2 other) => - (_min.x < other.x) && - (_min.y < other.y) && - (_max.x > other.x) && - (_max.y > other.y); + (_min.x < other.x) && (_min.y < other.y) && (_max.x > other.x) && (_max.y > other.y); /// Return if this intersects with [other]. bool intersectsWithAabb2(Aabb2 other) { @@ -162,8 +151,5 @@ class Aabb2 { /// Return if this intersects with [other]. bool intersectsWithVector2(Vector2 other) => - (_min.x <= other.x) && - (_min.y <= other.y) && - (_max.x >= other.x) && - (_max.y >= other.y); + (_min.x <= other.x) && (_min.y <= other.y) && (_max.x >= other.x) && (_max.y >= other.y); } diff --git a/packages/vector_math/lib/src/vector_math_64/aabb3.dart b/packages/vector_math/lib/src/vector_math_64/aabb3.dart index b5096f8..8e7c2a0 100644 --- a/packages/vector_math/lib/src/vector_math_64/aabb3.dart +++ b/packages/vector_math/lib/src/vector_math_64/aabb3.dart @@ -15,21 +15,16 @@ class Aabb3 { Aabb3() : _min = Vector3.zero(), _max = Vector3.zero(); /// Create a new AABB as a copy of [other]. - Aabb3.copy(Aabb3 other) - : _min = Vector3.copy(other._min), - _max = Vector3.copy(other._max); + Aabb3.copy(Aabb3 other) : _min = Vector3.copy(other._min), _max = Vector3.copy(other._max); /// Create a new AABB with a [min] and [max]. - Aabb3.minMax(Vector3 min, Vector3 max) - : _min = Vector3.copy(min), - _max = Vector3.copy(max); + Aabb3.minMax(Vector3 min, Vector3 max) : _min = Vector3.copy(min), _max = Vector3.copy(max); /// Create a new AABB that encloses a [sphere]. factory Aabb3.fromSphere(Sphere sphere) => Aabb3()..setSphere(sphere); /// Create a new AABB that encloses a [triangle]. - factory Aabb3.fromTriangle(Triangle triangle) => - Aabb3()..setTriangle(triangle); + factory Aabb3.fromTriangle(Triangle triangle) => Aabb3()..setTriangle(triangle); /// Create a new AABB that encloses a [quad]. factory Aabb3.fromQuad(Quad quad) => Aabb3()..setQuad(quad); @@ -51,10 +46,7 @@ class Aabb3 { /// [Float64List.bytesPerElement]. Aabb3.fromBuffer(ByteBuffer buffer, int offset) : _min = Vector3.fromBuffer(buffer, offset), - _max = Vector3.fromBuffer( - buffer, - offset + Float64List.bytesPerElement * 3, - ); + _max = Vector3.fromBuffer(buffer, offset + Float64List.bytesPerElement * 3); final Vector3 _min; final Vector3 _max; @@ -89,64 +81,28 @@ class Aabb3 { /// Set the AABB to enclose a [triangle]. void setTriangle(Triangle triangle) { _min.setValues( - math.min( - triangle._point0.x, - math.min(triangle._point1.x, triangle._point2.x), - ), - math.min( - triangle._point0.y, - math.min(triangle._point1.y, triangle._point2.y), - ), - math.min( - triangle._point0.z, - math.min(triangle._point1.z, triangle._point2.z), - ), + math.min(triangle._point0.x, math.min(triangle._point1.x, triangle._point2.x)), + math.min(triangle._point0.y, math.min(triangle._point1.y, triangle._point2.y)), + math.min(triangle._point0.z, math.min(triangle._point1.z, triangle._point2.z)), ); _max.setValues( - math.max( - triangle._point0.x, - math.max(triangle._point1.x, triangle._point2.x), - ), - math.max( - triangle._point0.y, - math.max(triangle._point1.y, triangle._point2.y), - ), - math.max( - triangle._point0.z, - math.max(triangle._point1.z, triangle._point2.z), - ), + math.max(triangle._point0.x, math.max(triangle._point1.x, triangle._point2.x)), + math.max(triangle._point0.y, math.max(triangle._point1.y, triangle._point2.y)), + math.max(triangle._point0.z, math.max(triangle._point1.z, triangle._point2.z)), ); } /// Set the AABB to enclose a [quad]. void setQuad(Quad quad) { _min.setValues( - math.min( - quad._point0.x, - math.min(quad._point1.x, math.min(quad._point2.x, quad._point3.x)), - ), - math.min( - quad._point0.y, - math.min(quad._point1.y, math.min(quad._point2.y, quad._point3.y)), - ), - math.min( - quad._point0.z, - math.min(quad._point1.z, math.min(quad._point2.z, quad._point3.z)), - ), + math.min(quad._point0.x, math.min(quad._point1.x, math.min(quad._point2.x, quad._point3.x))), + math.min(quad._point0.y, math.min(quad._point1.y, math.min(quad._point2.y, quad._point3.y))), + math.min(quad._point0.z, math.min(quad._point1.z, math.min(quad._point2.z, quad._point3.z))), ); _max.setValues( - math.max( - quad._point0.x, - math.max(quad._point1.x, math.max(quad._point2.x, quad._point3.x)), - ), - math.max( - quad._point0.y, - math.max(quad._point1.y, math.max(quad._point2.y, quad._point3.y)), - ), - math.max( - quad._point0.z, - math.max(quad._point1.z, math.max(quad._point2.z, quad._point3.z)), - ), + math.max(quad._point0.x, math.max(quad._point1.x, math.max(quad._point2.x, quad._point3.x))), + math.max(quad._point0.y, math.max(quad._point1.y, math.max(quad._point2.y, quad._point3.y))), + math.max(quad._point0.z, math.max(quad._point1.z, math.max(quad._point2.z, quad._point3.z))), ); } @@ -234,8 +190,7 @@ class Aabb3 { static final _center = Vector3.zero(); static final _halfExtents = Vector3.zero(); - void _updateCenterAndHalfExtents() => - copyCenterAndHalfExtents(_center, _halfExtents); + void _updateCenterAndHalfExtents() => copyCenterAndHalfExtents(_center, _halfExtents); /// Transform this by the transform [t]. void transform(Matrix4 t) { @@ -420,11 +375,7 @@ class Aabb3 { /// be used for the test. If [result] is specified and an intersection is /// found, result is modified to contain more details about the type of /// intersection. - bool intersectsWithTriangle( - Triangle other, { - double epsilon = 1e-3, - IntersectionResult? result, - }) { + bool intersectsWithTriangle(Triangle other, {double epsilon = 1e-3, IntersectionResult? result}) { double p0, p1, p2, r, len; double a; diff --git a/packages/vector_math/lib/src/vector_math_64/colors.dart b/packages/vector_math/lib/src/vector_math_64/colors.dart index 53194ec..bf8ad06 100644 --- a/packages/vector_math/lib/src/vector_math_64/colors.dart +++ b/packages/vector_math/lib/src/vector_math_64/colors.dart @@ -78,11 +78,7 @@ class Colors { /// the alpha channel, set [alpha] to true, it is false by default. If [short] /// is true, the resulting hex string might also be a short version, like #ff0 /// (default false). - static String toHexString( - Vector4 input, { - bool alpha = false, - bool short = false, - }) { + static String toHexString(Vector4 input, {bool alpha = false, bool short = false}) { final int r = (input.r * 0xFF).floor() & 0xFF; final int g = (input.g * 0xFF).floor() & 0xFF; final int b = (input.b * 0xFF).floor() & 0xFF; @@ -97,9 +93,7 @@ class Colors { if (isShort) { final String rgb = - (r & 0xF).toRadixString(16) + - (g & 0xF).toRadixString(16) + - (b & 0xF).toRadixString(16); + (r & 0xF).toRadixString(16) + (g & 0xF).toRadixString(16) + (b & 0xF).toRadixString(16); return alpha ? (a & 0xF).toRadixString(16) + rgb : rgb; } else { @@ -114,26 +108,16 @@ class Colors { /// Blend the [foreground] color over [background] color and store the color /// in [result]. - static void alphaBlend( - Vector4 foreground, - Vector4 background, - Vector4 result, - ) { + static void alphaBlend(Vector4 foreground, Vector4 background, Vector4 result) { final double a = foreground.a + (1.0 - foreground.a) * background.a; final double factor = 1.0 / a; final double r = - factor * - (foreground.a * foreground.r + - (1.0 - foreground.a) * background.a * background.r); + factor * (foreground.a * foreground.r + (1.0 - foreground.a) * background.a * background.r); final double g = - factor * - (foreground.a * foreground.g + - (1.0 - foreground.a) * background.a * background.g); + factor * (foreground.a * foreground.g + (1.0 - foreground.a) * background.a * background.g); final double b = - factor * - (foreground.a * foreground.b + - (1.0 - foreground.a) * background.a * background.b); + factor * (foreground.a * foreground.b + (1.0 - foreground.a) * background.a * background.b); result.setValues(r, g, b, a); } @@ -152,11 +136,7 @@ class Colors { /// Convert [linearColor] from linear space into gamma color space and store /// the result in [gammaColor]. It is possible to specify a optional [gamma], /// the default value is 2.2. - static void linearToGamma( - Vector4 linearColor, - Vector4 gammaColor, [ - double gamma = 2.2, - ]) { + static void linearToGamma(Vector4 linearColor, Vector4 gammaColor, [double gamma = 2.2]) { final double exponent = 1.0 / gamma; gammaColor @@ -169,11 +149,7 @@ class Colors { /// Convert [gammaColor] from gamma space into linear color space and store /// the result in [linearColor]. It is possible to specify a optional [gamma], /// the default value is 2.2. - static void gammaToLinear( - Vector4 gammaColor, - Vector4 linearColor, [ - double gamma = 2.2, - ]) { + static void gammaToLinear(Vector4 gammaColor, Vector4 linearColor, [double gamma = 2.2]) { linearColor ..r = math.pow(gammaColor.r, gamma).toDouble() ..g = math.pow(gammaColor.g, gamma).toDouble() @@ -193,9 +169,7 @@ class Colors { if (max != min) { if (max == rgbColor.r) { - h = - (rgbColor.g - rgbColor.b) / d + - (rgbColor.g < rgbColor.b ? 6.0 : 0.0); + h = (rgbColor.g - rgbColor.b) / d + (rgbColor.g < rgbColor.b ? 6.0 : 0.0); } else if (max == rgbColor.g) { h = (rgbColor.b - rgbColor.r) / d + 2.0; } else { @@ -248,9 +222,7 @@ class Colors { s = l > 0.5 ? d / (2.0 - max - min) : d / (max + min); if (max == rgbColor.r) { - h = - (rgbColor.g - rgbColor.b) / d + - (rgbColor.g < rgbColor.b ? 6.0 : 0.0); + h = (rgbColor.g - rgbColor.b) / d + (rgbColor.g < rgbColor.b ? 6.0 : 0.0); } else if (max == rgbColor.g) { h = (rgbColor.b - rgbColor.r) / d + 2.0; } else { @@ -313,44 +285,37 @@ class Colors { Vector4(250.0 / 255.0, 235.0 / 255.0, 215.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'aqua'. - static Vector4 get aqua => - Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get aqua => Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'aquamarine'. static Vector4 get aquamarine => Vector4(127.0 / 255.0, 255.0 / 255.0, 212.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'azure'. - static Vector4 get azure => - Vector4(240.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get azure => Vector4(240.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'beige'. - static Vector4 get beige => - Vector4(245.0 / 255.0, 245.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); + static Vector4 get beige => Vector4(245.0 / 255.0, 245.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'bisque'. - static Vector4 get bisque => - Vector4(255.0 / 255.0, 228.0 / 255.0, 196.0 / 255.0, 255.0 / 255.0); + static Vector4 get bisque => Vector4(255.0 / 255.0, 228.0 / 255.0, 196.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'black'. - static Vector4 get black => - Vector4(0.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get black => Vector4(0.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blanchedalmond'. static Vector4 get blanchedAlmond => Vector4(255.0 / 255.0, 235.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blue'. - static Vector4 get blue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get blue => Vector4(0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'blueviolet'. static Vector4 get blueViolet => Vector4(138.0 / 255.0, 43.0 / 255.0, 226.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'brown'. - static Vector4 get brown => - Vector4(165.0 / 255.0, 42.0 / 255.0, 42.0 / 255.0, 255.0 / 255.0); + static Vector4 get brown => Vector4(165.0 / 255.0, 42.0 / 255.0, 42.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'burlywood'. static Vector4 get burlyWood => @@ -369,8 +334,7 @@ class Colors { Vector4(210.0 / 255.0, 105.0 / 255.0, 30.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'coral'. - static Vector4 get coral => - Vector4(255.0 / 255.0, 127.0 / 255.0, 80.0 / 255.0, 255.0 / 255.0); + static Vector4 get coral => Vector4(255.0 / 255.0, 127.0 / 255.0, 80.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'cornflowerblue'. static Vector4 get cornflowerBlue => @@ -381,20 +345,16 @@ class Colors { Vector4(255.0 / 255.0, 248.0 / 255.0, 220.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'crimson'. - static Vector4 get crimson => - Vector4(220.0 / 255.0, 20.0 / 255.0, 60.0 / 255.0, 255.0 / 255.0); + static Vector4 get crimson => Vector4(220.0 / 255.0, 20.0 / 255.0, 60.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'cyan'. - static Vector4 get cyan => - Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get cyan => Vector4(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkblue'. - static Vector4 get darkBlue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkBlue => Vector4(0.0 / 255.0, 0.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkcyan'. - static Vector4 get darkCyan => - Vector4(0.0 / 255.0, 139.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkCyan => Vector4(0.0 / 255.0, 139.0 / 255.0, 139.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkgoldenrod'. static Vector4 get darkGoldenrod => @@ -405,8 +365,7 @@ class Colors { Vector4(169.0 / 255.0, 169.0 / 255.0, 169.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkgreen'. - static Vector4 get darkGreen => - Vector4(0.0 / 255.0, 100.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkGreen => Vector4(0.0 / 255.0, 100.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkkhaki'. static Vector4 get darkKhaki => @@ -429,8 +388,7 @@ class Colors { Vector4(153.0 / 255.0, 50.0 / 255.0, 204.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darkred'. - static Vector4 get darkRed => - Vector4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get darkRed => Vector4(139.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'darksalmon'. static Vector4 get darkSalmon => @@ -457,24 +415,21 @@ class Colors { Vector4(148.0 / 255.0, 0.0 / 255.0, 211.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'deeppink'. - static Vector4 get deepPink => - Vector4(255.0 / 255.0, 20.0 / 255.0, 147.0 / 255.0, 255.0 / 255.0); + static Vector4 get deepPink => Vector4(255.0 / 255.0, 20.0 / 255.0, 147.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'deepskyblue'. static Vector4 get deepSkyBlue => Vector4(0.0 / 255.0, 191.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'dimgray'. - static Vector4 get dimGray => - Vector4(105.0 / 255.0, 105.0 / 255.0, 105.0 / 255.0, 255.0 / 255.0); + static Vector4 get dimGray => Vector4(105.0 / 255.0, 105.0 / 255.0, 105.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'dodgerblue'. static Vector4 get dodgerBlue => Vector4(30.0 / 255.0, 144.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'firebrick'. - static Vector4 get firebrick => - Vector4(178.0 / 255.0, 34.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); + static Vector4 get firebrick => Vector4(178.0 / 255.0, 34.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'floralwhite'. static Vector4 get floralWhite => @@ -485,8 +440,7 @@ class Colors { Vector4(34.0 / 255.0, 139.0 / 255.0, 34.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'fuchsia'. - static Vector4 get fuchsia => - Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get fuchsia => Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gainsboro'. static Vector4 get gainsboro => @@ -497,20 +451,17 @@ class Colors { Vector4(248.0 / 255.0, 248.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gold'. - static Vector4 get gold => - Vector4(255.0 / 255.0, 215.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get gold => Vector4(255.0 / 255.0, 215.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'goldenrod'. static Vector4 get goldenrod => Vector4(218.0 / 255.0, 165.0 / 255.0, 32.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'gray'. - static Vector4 get gray => - Vector4(128.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get gray => Vector4(128.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'green'. - static Vector4 get green => - Vector4(0.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get green => Vector4(0.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'greenyellow'. static Vector4 get greenYellow => @@ -521,24 +472,19 @@ class Colors { Vector4(240.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'hotpink'. - static Vector4 get hotPink => - Vector4(255.0 / 255.0, 105.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); + static Vector4 get hotPink => Vector4(255.0 / 255.0, 105.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'indianred'. - static Vector4 get indianRed => - Vector4(205.0 / 255.0, 92.0 / 255.0, 92.0 / 255.0, 255.0 / 255.0); + static Vector4 get indianRed => Vector4(205.0 / 255.0, 92.0 / 255.0, 92.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'indigo'. - static Vector4 get indigo => - Vector4(75.0 / 255.0, 0.0 / 255.0, 130.0 / 255.0, 255.0 / 255.0); + static Vector4 get indigo => Vector4(75.0 / 255.0, 0.0 / 255.0, 130.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'ivory'. - static Vector4 get ivory => - Vector4(255.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); + static Vector4 get ivory => Vector4(255.0 / 255.0, 255.0 / 255.0, 240.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'khaki'. - static Vector4 get khaki => - Vector4(240.0 / 255.0, 230.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); + static Vector4 get khaki => Vector4(240.0 / 255.0, 230.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lavender'. static Vector4 get lavender => @@ -549,8 +495,7 @@ class Colors { Vector4(255.0 / 255.0, 240.0 / 255.0, 245.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lawngreen'. - static Vector4 get lawnGreen => - Vector4(124.0 / 255.0, 252.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get lawnGreen => Vector4(124.0 / 255.0, 252.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lemonchiffon'. static Vector4 get lemonChiffon => @@ -609,32 +554,26 @@ class Colors { Vector4(255.0 / 255.0, 255.0 / 255.0, 224.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'lime'. - static Vector4 get lime => - Vector4(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get lime => Vector4(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'limegreen'. - static Vector4 get limeGreen => - Vector4(50.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 255.0 / 255.0); + static Vector4 get limeGreen => Vector4(50.0 / 255.0, 205.0 / 255.0, 50.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'linen'. - static Vector4 get linen => - Vector4(250.0 / 255.0, 240.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); + static Vector4 get linen => Vector4(250.0 / 255.0, 240.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'magenta'. - static Vector4 get magenta => - Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get magenta => Vector4(255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'maroon'. - static Vector4 get maroon => - Vector4(128.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get maroon => Vector4(128.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumaquamarine'. static Vector4 get mediumAquamarine => Vector4(102.0 / 255.0, 205.0 / 255.0, 170.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumblue'. - static Vector4 get mediumBlue => - Vector4(0.0 / 255.0, 0.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); + static Vector4 get mediumBlue => Vector4(0.0 / 255.0, 0.0 / 255.0, 205.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'mediumorchid'. static Vector4 get mediumOrchid => @@ -685,32 +624,26 @@ class Colors { Vector4(255.0 / 255.0, 222.0 / 255.0, 173.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'navy'. - static Vector4 get navy => - Vector4(0.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get navy => Vector4(0.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'oldlace'. - static Vector4 get oldLace => - Vector4(253.0 / 255.0, 245.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); + static Vector4 get oldLace => Vector4(253.0 / 255.0, 245.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'olive'. - static Vector4 get olive => - Vector4(128.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get olive => Vector4(128.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'olivedrab'. static Vector4 get oliveDrab => Vector4(107.0 / 255.0, 142.0 / 255.0, 35.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orange'. - static Vector4 get orange => - Vector4(255.0 / 255.0, 165.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get orange => Vector4(255.0 / 255.0, 165.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orangered'. - static Vector4 get orangeRed => - Vector4(255.0 / 255.0, 69.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get orangeRed => Vector4(255.0 / 255.0, 69.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'orchid'. - static Vector4 get orchid => - Vector4(218.0 / 255.0, 112.0 / 255.0, 214.0 / 255.0, 255.0 / 255.0); + static Vector4 get orchid => Vector4(218.0 / 255.0, 112.0 / 255.0, 214.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'palegoldenrod'. static Vector4 get paleGoldenrod => @@ -737,28 +670,23 @@ class Colors { Vector4(255.0 / 255.0, 218.0 / 255.0, 185.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'peru'. - static Vector4 get peru => - Vector4(205.0 / 255.0, 133.0 / 255.0, 63.0 / 255.0, 255.0 / 255.0); + static Vector4 get peru => Vector4(205.0 / 255.0, 133.0 / 255.0, 63.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'pink'. - static Vector4 get pink => - Vector4(255.0 / 255.0, 192.0 / 255.0, 203.0 / 255.0, 255.0 / 255.0); + static Vector4 get pink => Vector4(255.0 / 255.0, 192.0 / 255.0, 203.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'plum'. - static Vector4 get plum => - Vector4(221.0 / 255.0, 160.0 / 255.0, 221.0 / 255.0, 255.0 / 255.0); + static Vector4 get plum => Vector4(221.0 / 255.0, 160.0 / 255.0, 221.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'powderblue'. static Vector4 get powderBlue => Vector4(176.0 / 255.0, 224.0 / 255.0, 230.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'purple'. - static Vector4 get purple => - Vector4(128.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get purple => Vector4(128.0 / 255.0, 0.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'red'. - static Vector4 get red => - Vector4(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get red => Vector4(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'rosybrown'. static Vector4 get rosyBrown => @@ -773,32 +701,27 @@ class Colors { Vector4(139.0 / 255.0, 69.0 / 255.0, 19.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'salmon'. - static Vector4 get salmon => - Vector4(250.0 / 255.0, 128.0 / 255.0, 114.0 / 255.0, 255.0 / 255.0); + static Vector4 get salmon => Vector4(250.0 / 255.0, 128.0 / 255.0, 114.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'sandybrown'. static Vector4 get sandyBrown => Vector4(244.0 / 255.0, 164.0 / 255.0, 96.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'seagreen'. - static Vector4 get seaGreen => - Vector4(46.0 / 255.0, 139.0 / 255.0, 87.0 / 255.0, 255.0 / 255.0); + static Vector4 get seaGreen => Vector4(46.0 / 255.0, 139.0 / 255.0, 87.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'seashell'. static Vector4 get seaShell => Vector4(255.0 / 255.0, 245.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'sienna'. - static Vector4 get sienna => - Vector4(160.0 / 255.0, 82.0 / 255.0, 45.0 / 255.0, 255.0 / 255.0); + static Vector4 get sienna => Vector4(160.0 / 255.0, 82.0 / 255.0, 45.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'silver'. - static Vector4 get silver => - Vector4(192.0 / 255.0, 192.0 / 255.0, 192.0 / 255.0, 255.0 / 255.0); + static Vector4 get silver => Vector4(192.0 / 255.0, 192.0 / 255.0, 192.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'skyblue'. - static Vector4 get skyBlue => - Vector4(135.0 / 255.0, 206.0 / 255.0, 235.0 / 255.0, 255.0 / 255.0); + static Vector4 get skyBlue => Vector4(135.0 / 255.0, 206.0 / 255.0, 235.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'slateblue'. static Vector4 get slateBlue => @@ -809,8 +732,7 @@ class Colors { Vector4(112.0 / 255.0, 128.0 / 255.0, 144.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'snow'. - static Vector4 get snow => - Vector4(255.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0, 255.0 / 255.0); + static Vector4 get snow => Vector4(255.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'springgreen'. static Vector4 get springGreen => @@ -821,44 +743,36 @@ class Colors { Vector4(70.0 / 255.0, 130.0 / 255.0, 180.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'tan'. - static Vector4 get tan => - Vector4(210.0 / 255.0, 180.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); + static Vector4 get tan => Vector4(210.0 / 255.0, 180.0 / 255.0, 140.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'teal'. - static Vector4 get teal => - Vector4(0.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); + static Vector4 get teal => Vector4(0.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'thistle'. - static Vector4 get thistle => - Vector4(216.0 / 255.0, 191.0 / 255.0, 216.0 / 255.0, 255.0 / 255.0); + static Vector4 get thistle => Vector4(216.0 / 255.0, 191.0 / 255.0, 216.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'tomato'. - static Vector4 get tomato => - Vector4(255.0 / 255.0, 99.0 / 255.0, 71.0 / 255.0, 255.0 / 255.0); + static Vector4 get tomato => Vector4(255.0 / 255.0, 99.0 / 255.0, 71.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'turquoise'. static Vector4 get turquoise => Vector4(64.0 / 255.0, 224.0 / 255.0, 208.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'violet'. - static Vector4 get violet => - Vector4(238.0 / 255.0, 130.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); + static Vector4 get violet => Vector4(238.0 / 255.0, 130.0 / 255.0, 238.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'wheat'. - static Vector4 get wheat => - Vector4(245.0 / 255.0, 222.0 / 255.0, 179.0 / 255.0, 255.0 / 255.0); + static Vector4 get wheat => Vector4(245.0 / 255.0, 222.0 / 255.0, 179.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'white'. - static Vector4 get white => - Vector4(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); + static Vector4 get white => Vector4(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'whitesmoke'. static Vector4 get whiteSmoke => Vector4(245.0 / 255.0, 245.0 / 255.0, 245.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'yellow'. - static Vector4 get yellow => - Vector4(255.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); + static Vector4 get yellow => Vector4(255.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0, 255.0 / 255.0); /// RGBA values for the named CSS color 'yellowgreen'. static Vector4 get yellowGreen => diff --git a/packages/vector_math/lib/src/vector_math_64/matrix2.dart b/packages/vector_math/lib/src/vector_math_64/matrix2.dart index 804aee8..0a6ddb4 100644 --- a/packages/vector_math/lib/src/vector_math_64/matrix2.dart +++ b/packages/vector_math/lib/src/vector_math_64/matrix2.dart @@ -27,15 +27,13 @@ class Matrix2 { factory Matrix2.copy(Matrix2 other) => Matrix2.zero()..setFrom(other); /// Matrix with values from column arguments. - factory Matrix2.columns(Vector2 arg0, Vector2 arg1) => - Matrix2.zero()..setColumns(arg0, arg1); + factory Matrix2.columns(Vector2 arg0, Vector2 arg1) => Matrix2.zero()..setColumns(arg0, arg1); /// Outer product of [u] and [v]. factory Matrix2.outer(Vector2 u, Vector2 v) => Matrix2.zero()..setOuter(u, v); /// Rotation of [radians]. - factory Matrix2.rotation(double radians) => - Matrix2.zero()..setRotation(radians); + factory Matrix2.rotation(double radians) => Matrix2.zero()..setRotation(radians); final Float64List _m2storage; /// The components of the matrix. @@ -282,8 +280,7 @@ class Matrix2 { } /// Returns the determinant of this matrix. - double determinant() => - (_m2storage[0] * _m2storage[3]) - (_m2storage[1] * _m2storage[2]); + double determinant() => (_m2storage[0] * _m2storage[3]) - (_m2storage[1] * _m2storage[2]); /// Returns the dot product of row [i] and [v]. double dotRow(int i, Vector2 v) { @@ -294,8 +291,7 @@ class Matrix2 { /// Returns the dot product of column [j] and [v]. double dotColumn(int j, Vector2 v) { final Float64List vStorage = v._v2storage; - return _m2storage[j * 2] * vStorage[0] + - _m2storage[(j * 2) + 1] * vStorage[1]; + return _m2storage[j * 2] * vStorage[0] + _m2storage[(j * 2) + 1] * vStorage[1]; } /// Trace of the matrix. @@ -477,10 +473,8 @@ class Matrix2 { /// this. Vector2 transform(Vector2 arg) { final Float64List argStorage = arg._v2storage; - final double x = - (_m2storage[0] * argStorage[0]) + (_m2storage[2] * argStorage[1]); - final double y = - (_m2storage[1] * argStorage[0]) + (_m2storage[3] * argStorage[1]); + final double x = (_m2storage[0] * argStorage[0]) + (_m2storage[2] * argStorage[1]); + final double y = (_m2storage[1] * argStorage[0]) + (_m2storage[3] * argStorage[1]); argStorage[0] = x; argStorage[1] = y; return arg; diff --git a/packages/vector_math/lib/src/vector_math_64/matrix3.dart b/packages/vector_math/lib/src/vector_math_64/matrix3.dart index a15db74..974aafe 100644 --- a/packages/vector_math/lib/src/vector_math_64/matrix3.dart +++ b/packages/vector_math/lib/src/vector_math_64/matrix3.dart @@ -22,9 +22,7 @@ class Matrix3 { double arg6, double arg7, double arg8, - ) => - Matrix3.zero() - ..setValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + ) => Matrix3.zero()..setValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); /// New matrix from [values]. factory Matrix3.fromList(List values) => Matrix3.zero() @@ -60,16 +58,13 @@ class Matrix3 { factory Matrix3.outer(Vector3 u, Vector3 v) => Matrix3.zero()..setOuter(u, v); /// Rotation of [radians] around X axis. - factory Matrix3.rotationX(double radians) => - Matrix3.zero()..setRotationX(radians); + factory Matrix3.rotationX(double radians) => Matrix3.zero()..setRotationX(radians); /// Rotation of [radians] around Y axis. - factory Matrix3.rotationY(double radians) => - Matrix3.zero()..setRotationY(radians); + factory Matrix3.rotationY(double radians) => Matrix3.zero()..setRotationY(radians); /// Rotation of [radians] around Z axis. - factory Matrix3.rotationZ(double radians) => - Matrix3.zero()..setRotationZ(radians); + factory Matrix3.rotationZ(double radians) => Matrix3.zero()..setRotationZ(radians); final Float64List _m3storage; /// The components of the matrix. @@ -449,14 +444,11 @@ class Matrix3 { /// Returns the determinant of this matrix. double determinant() { final double x = - _m3storage[0] * - ((_m3storage[4] * _m3storage[8]) - (_m3storage[5] * _m3storage[7])); + _m3storage[0] * ((_m3storage[4] * _m3storage[8]) - (_m3storage[5] * _m3storage[7])); final double y = - _m3storage[1] * - ((_m3storage[3] * _m3storage[8]) - (_m3storage[5] * _m3storage[6])); + _m3storage[1] * ((_m3storage[3] * _m3storage[8]) - (_m3storage[5] * _m3storage[6])); final double z = - _m3storage[2] * - ((_m3storage[3] * _m3storage[7]) - (_m3storage[4] * _m3storage[6])); + _m3storage[2] * ((_m3storage[3] * _m3storage[7]) - (_m3storage[4] * _m3storage[6])); return x - y + z; } @@ -541,33 +533,15 @@ class Matrix3 { } final double invDet = 1.0 / det; final Float64List argStorage = arg._m3storage; - final double ix = - invDet * - (argStorage[4] * argStorage[8] - argStorage[5] * argStorage[7]); - final double iy = - invDet * - (argStorage[2] * argStorage[7] - argStorage[1] * argStorage[8]); - final double iz = - invDet * - (argStorage[1] * argStorage[5] - argStorage[2] * argStorage[4]); - final double jx = - invDet * - (argStorage[5] * argStorage[6] - argStorage[3] * argStorage[8]); - final double jy = - invDet * - (argStorage[0] * argStorage[8] - argStorage[2] * argStorage[6]); - final double jz = - invDet * - (argStorage[2] * argStorage[3] - argStorage[0] * argStorage[5]); - final double kx = - invDet * - (argStorage[3] * argStorage[7] - argStorage[4] * argStorage[6]); - final double ky = - invDet * - (argStorage[1] * argStorage[6] - argStorage[0] * argStorage[7]); - final double kz = - invDet * - (argStorage[0] * argStorage[4] - argStorage[1] * argStorage[3]); + final double ix = invDet * (argStorage[4] * argStorage[8] - argStorage[5] * argStorage[7]); + final double iy = invDet * (argStorage[2] * argStorage[7] - argStorage[1] * argStorage[8]); + final double iz = invDet * (argStorage[1] * argStorage[5] - argStorage[2] * argStorage[4]); + final double jx = invDet * (argStorage[5] * argStorage[6] - argStorage[3] * argStorage[8]); + final double jy = invDet * (argStorage[0] * argStorage[8] - argStorage[2] * argStorage[6]); + final double jz = invDet * (argStorage[2] * argStorage[3] - argStorage[0] * argStorage[5]); + final double kx = invDet * (argStorage[3] * argStorage[7] - argStorage[4] * argStorage[6]); + final double ky = invDet * (argStorage[1] * argStorage[6] - argStorage[0] * argStorage[7]); + final double kz = invDet * (argStorage[0] * argStorage[4] - argStorage[1] * argStorage[3]); _m3storage[0] = ix; _m3storage[1] = iy; _m3storage[2] = iz; @@ -696,13 +670,9 @@ class Matrix3 { Vector2 transform2(Vector2 arg) { final Float64List argStorage = arg._v2storage; final double x_ = - (_m3storage[0] * argStorage[0]) + - (_m3storage[3] * argStorage[1]) + - _m3storage[6]; + (_m3storage[0] * argStorage[0]) + (_m3storage[3] * argStorage[1]) + _m3storage[6]; final double y_ = - (_m3storage[1] * argStorage[0]) + - (_m3storage[4] * argStorage[1]) + - _m3storage[7]; + (_m3storage[1] * argStorage[0]) + (_m3storage[4] * argStorage[1]) + _m3storage[7]; argStorage[0] = x_; argStorage[1] = y_; return arg; @@ -811,24 +781,15 @@ class Matrix3 { final double m21 = _m3storage[7]; final double m22 = _m3storage[8]; final Float64List argStorage = arg._m3storage; - _m3storage[0] = - (m00 * argStorage[0]) + (m01 * argStorage[1]) + (m02 * argStorage[2]); - _m3storage[3] = - (m00 * argStorage[3]) + (m01 * argStorage[4]) + (m02 * argStorage[5]); - _m3storage[6] = - (m00 * argStorage[6]) + (m01 * argStorage[7]) + (m02 * argStorage[8]); - _m3storage[1] = - (m10 * argStorage[0]) + (m11 * argStorage[1]) + (m12 * argStorage[2]); - _m3storage[4] = - (m10 * argStorage[3]) + (m11 * argStorage[4]) + (m12 * argStorage[5]); - _m3storage[7] = - (m10 * argStorage[6]) + (m11 * argStorage[7]) + (m12 * argStorage[8]); - _m3storage[2] = - (m20 * argStorage[0]) + (m21 * argStorage[1]) + (m22 * argStorage[2]); - _m3storage[5] = - (m20 * argStorage[3]) + (m21 * argStorage[4]) + (m22 * argStorage[5]); - _m3storage[8] = - (m20 * argStorage[6]) + (m21 * argStorage[7]) + (m22 * argStorage[8]); + _m3storage[0] = (m00 * argStorage[0]) + (m01 * argStorage[1]) + (m02 * argStorage[2]); + _m3storage[3] = (m00 * argStorage[3]) + (m01 * argStorage[4]) + (m02 * argStorage[5]); + _m3storage[6] = (m00 * argStorage[6]) + (m01 * argStorage[7]) + (m02 * argStorage[8]); + _m3storage[1] = (m10 * argStorage[0]) + (m11 * argStorage[1]) + (m12 * argStorage[2]); + _m3storage[4] = (m10 * argStorage[3]) + (m11 * argStorage[4]) + (m12 * argStorage[5]); + _m3storage[7] = (m10 * argStorage[6]) + (m11 * argStorage[7]) + (m12 * argStorage[8]); + _m3storage[2] = (m20 * argStorage[0]) + (m21 * argStorage[1]) + (m22 * argStorage[2]); + _m3storage[5] = (m20 * argStorage[3]) + (m21 * argStorage[4]) + (m22 * argStorage[5]); + _m3storage[8] = (m20 * argStorage[6]) + (m21 * argStorage[7]) + (m22 * argStorage[8]); } void multiplyTranspose(Matrix3 arg) { @@ -842,24 +803,15 @@ class Matrix3 { final double m21 = _m3storage[5]; final double m22 = _m3storage[8]; final Float64List argStorage = arg._m3storage; - _m3storage[0] = - (m00 * argStorage[0]) + (m01 * argStorage[3]) + (m02 * argStorage[6]); - _m3storage[3] = - (m00 * argStorage[1]) + (m01 * argStorage[4]) + (m02 * argStorage[7]); - _m3storage[6] = - (m00 * argStorage[2]) + (m01 * argStorage[5]) + (m02 * argStorage[8]); - _m3storage[1] = - (m10 * argStorage[0]) + (m11 * argStorage[3]) + (m12 * argStorage[6]); - _m3storage[4] = - (m10 * argStorage[1]) + (m11 * argStorage[4]) + (m12 * argStorage[7]); - _m3storage[7] = - (m10 * argStorage[2]) + (m11 * argStorage[5]) + (m12 * argStorage[8]); - _m3storage[2] = - (m20 * argStorage[0]) + (m21 * argStorage[3]) + (m22 * argStorage[6]); - _m3storage[5] = - (m20 * argStorage[1]) + (m21 * argStorage[4]) + (m22 * argStorage[7]); - _m3storage[8] = - (m20 * argStorage[2]) + (m21 * argStorage[5]) + (m22 * argStorage[8]); + _m3storage[0] = (m00 * argStorage[0]) + (m01 * argStorage[3]) + (m02 * argStorage[6]); + _m3storage[3] = (m00 * argStorage[1]) + (m01 * argStorage[4]) + (m02 * argStorage[7]); + _m3storage[6] = (m00 * argStorage[2]) + (m01 * argStorage[5]) + (m02 * argStorage[8]); + _m3storage[1] = (m10 * argStorage[0]) + (m11 * argStorage[3]) + (m12 * argStorage[6]); + _m3storage[4] = (m10 * argStorage[1]) + (m11 * argStorage[4]) + (m12 * argStorage[7]); + _m3storage[7] = (m10 * argStorage[2]) + (m11 * argStorage[5]) + (m12 * argStorage[8]); + _m3storage[2] = (m20 * argStorage[0]) + (m21 * argStorage[3]) + (m22 * argStorage[6]); + _m3storage[5] = (m20 * argStorage[1]) + (m21 * argStorage[4]) + (m22 * argStorage[7]); + _m3storage[8] = (m20 * argStorage[2]) + (m21 * argStorage[5]) + (m22 * argStorage[8]); } /// Transform [arg] of type [Vector3] using the transformation defined by diff --git a/packages/vector_math/lib/src/vector_math_64/matrix4.dart b/packages/vector_math/lib/src/vector_math_64/matrix4.dart index 0985d2a..10aea3d 100644 --- a/packages/vector_math/lib/src/vector_math_64/matrix4.dart +++ b/packages/vector_math/lib/src/vector_math_64/matrix4.dart @@ -94,12 +94,8 @@ class Matrix4 { } /// Constructs a new mat4 from columns. - factory Matrix4.columns( - Vector4 arg0, - Vector4 arg1, - Vector4 arg2, - Vector4 arg3, - ) => Matrix4.zero()..setColumns(arg0, arg1, arg2, arg3); + factory Matrix4.columns(Vector4 arg0, Vector4 arg1, Vector4 arg2, Vector4 arg3) => + Matrix4.zero()..setColumns(arg0, arg1, arg2, arg3); /// Outer product of [u] and [v]. factory Matrix4.outer(Vector4 u, Vector4 v) => Matrix4.zero()..setOuter(u, v); @@ -125,10 +121,9 @@ class Matrix4 { ..setTranslation(translation); /// Translation matrix. - factory Matrix4.translationValues(double x, double y, double z) => - Matrix4.zero() - ..setIdentity() - ..setTranslationRaw(x, y, z); + factory Matrix4.translationValues(double x, double y, double z) => Matrix4.zero() + ..setIdentity() + ..setTranslationRaw(x, y, z); /// Scale matrix. factory Matrix4.diagonal3(Vector3 scale) { @@ -143,12 +138,11 @@ class Matrix4 { } /// Scale matrix. - factory Matrix4.diagonal3Values(double x, double y, double z) => - Matrix4.zero() - .._m4storage[15] = 1.0 - .._m4storage[10] = z - .._m4storage[5] = y - .._m4storage[0] = x; + factory Matrix4.diagonal3Values(double x, double y, double z) => Matrix4.zero() + .._m4storage[15] = 1.0 + .._m4storage[10] = z + .._m4storage[5] = y + .._m4storage[0] = x; /// Skew matrix around X axis factory Matrix4.skewX(double alpha) { @@ -181,13 +175,8 @@ class Matrix4 { : _m4storage = Float64List.view(buffer, offset, 16); /// Constructs Matrix4 from [translation], [rotation] and [scale]. - factory Matrix4.compose( - Vector3 translation, - Quaternion rotation, - Vector3 scale, - ) => - Matrix4.zero() - ..setFromTranslationRotationScale(translation, rotation, scale); + factory Matrix4.compose(Vector3 translation, Quaternion rotation, Vector3 scale) => + Matrix4.zero()..setFromTranslationRotationScale(translation, rotation, scale); final Float64List _m4storage; /// The components of the matrix. @@ -299,8 +288,7 @@ class Matrix4 { final double bZ = b.storage[2]; final double bW = b.storage[3]; - double det = - b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + double det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (det != 0.0) { det = 1.0 / det; @@ -493,11 +481,7 @@ class Matrix4 { } /// Sets the matrix from [translation], [rotation] and [scale]. - void setFromTranslationRotationScale( - Vector3 translation, - Quaternion rotation, - Vector3 scale, - ) { + void setFromTranslationRotationScale(Vector3 translation, Quaternion rotation, Vector3 scale) { setFromTranslationRotation(translation, rotation); scaleByVector3(scale); } @@ -736,31 +720,19 @@ class Matrix4 { /// Translate this matrix by x, y, z, w. void translateByDouble(double tx, double ty, double tz, double tw) { final double t1 = - _m4storage[0] * tx + - _m4storage[4] * ty + - _m4storage[8] * tz + - _m4storage[12] * tw; + _m4storage[0] * tx + _m4storage[4] * ty + _m4storage[8] * tz + _m4storage[12] * tw; _m4storage[12] = t1; final double t2 = - _m4storage[1] * tx + - _m4storage[5] * ty + - _m4storage[9] * tz + - _m4storage[13] * tw; + _m4storage[1] * tx + _m4storage[5] * ty + _m4storage[9] * tz + _m4storage[13] * tw; _m4storage[13] = t2; final double t3 = - _m4storage[2] * tx + - _m4storage[6] * ty + - _m4storage[10] * tz + - _m4storage[14] * tw; + _m4storage[2] * tx + _m4storage[6] * ty + _m4storage[10] * tz + _m4storage[14] * tw; _m4storage[14] = t3; final double t4 = - _m4storage[3] * tx + - _m4storage[7] * ty + - _m4storage[11] * tz + - _m4storage[15] * tw; + _m4storage[3] * tx + _m4storage[7] * ty + _m4storage[11] * tz + _m4storage[15] * tw; _m4storage[15] = t4; } @@ -768,22 +740,19 @@ class Matrix4 { @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector2(Vector2 v2) => - translateByDouble(v2.x, v2.y, 0.0, 1.0); + void translateByVector2(Vector2 v2) => translateByDouble(v2.x, v2.y, 0.0, 1.0); /// Translate this matrix by a [Vector3]. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector3(Vector3 v3) => - translateByDouble(v3.x, v3.y, v3.z, 1.0); + void translateByVector3(Vector3 v3) => translateByDouble(v3.x, v3.y, v3.z, 1.0); /// Translate this matrix by a [Vector4]. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void translateByVector4(Vector4 v4) => - translateByDouble(v4.x, v4.y, v4.z, v4.w); + void translateByVector4(Vector4 v4) => translateByDouble(v4.x, v4.y, v4.z, v4.w); /// Multiply this by a translation from the left. /// @@ -847,22 +816,19 @@ class Matrix4 { @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector2(Vector2 v2) => - leftTranslateByDouble(v2.x, v2.y, 0.0, 1.0); + void leftTranslateByVector2(Vector2 v2) => leftTranslateByDouble(v2.x, v2.y, 0.0, 1.0); /// Multiply this by a translation from the left. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector3(Vector3 v3) => - leftTranslateByDouble(v3.x, v3.y, v3.z, 1.0); + void leftTranslateByVector3(Vector3 v3) => leftTranslateByDouble(v3.x, v3.y, v3.z, 1.0); /// Multiply this by a translation from the left. @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - void leftTranslateByVector4(Vector4 v4) => - leftTranslateByDouble(v4.x, v4.y, v4.z, v4.w); + void leftTranslateByVector4(Vector4 v4) => leftTranslateByDouble(v4.x, v4.y, v4.z, v4.w); /// Rotate this [angle] radians around [axis] void rotate(Vector3 axis, double angle) { @@ -883,30 +849,18 @@ class Matrix4 { final double m31 = z * x * C - y * s; final double m32 = z * y * C + x * s; final double m33 = z * z * C + c; - final double t1 = - _m4storage[0] * m11 + _m4storage[4] * m21 + _m4storage[8] * m31; - final double t2 = - _m4storage[1] * m11 + _m4storage[5] * m21 + _m4storage[9] * m31; - final double t3 = - _m4storage[2] * m11 + _m4storage[6] * m21 + _m4storage[10] * m31; - final double t4 = - _m4storage[3] * m11 + _m4storage[7] * m21 + _m4storage[11] * m31; - final double t5 = - _m4storage[0] * m12 + _m4storage[4] * m22 + _m4storage[8] * m32; - final double t6 = - _m4storage[1] * m12 + _m4storage[5] * m22 + _m4storage[9] * m32; - final double t7 = - _m4storage[2] * m12 + _m4storage[6] * m22 + _m4storage[10] * m32; - final double t8 = - _m4storage[3] * m12 + _m4storage[7] * m22 + _m4storage[11] * m32; - final double t9 = - _m4storage[0] * m13 + _m4storage[4] * m23 + _m4storage[8] * m33; - final double t10 = - _m4storage[1] * m13 + _m4storage[5] * m23 + _m4storage[9] * m33; - final double t11 = - _m4storage[2] * m13 + _m4storage[6] * m23 + _m4storage[10] * m33; - final double t12 = - _m4storage[3] * m13 + _m4storage[7] * m23 + _m4storage[11] * m33; + final double t1 = _m4storage[0] * m11 + _m4storage[4] * m21 + _m4storage[8] * m31; + final double t2 = _m4storage[1] * m11 + _m4storage[5] * m21 + _m4storage[9] * m31; + final double t3 = _m4storage[2] * m11 + _m4storage[6] * m21 + _m4storage[10] * m31; + final double t4 = _m4storage[3] * m11 + _m4storage[7] * m21 + _m4storage[11] * m31; + final double t5 = _m4storage[0] * m12 + _m4storage[4] * m22 + _m4storage[8] * m32; + final double t6 = _m4storage[1] * m12 + _m4storage[5] * m22 + _m4storage[9] * m32; + final double t7 = _m4storage[2] * m12 + _m4storage[6] * m22 + _m4storage[10] * m32; + final double t8 = _m4storage[3] * m12 + _m4storage[7] * m22 + _m4storage[11] * m32; + final double t9 = _m4storage[0] * m13 + _m4storage[4] * m23 + _m4storage[8] * m33; + final double t10 = _m4storage[1] * m13 + _m4storage[5] * m23 + _m4storage[9] * m33; + final double t11 = _m4storage[2] * m13 + _m4storage[6] * m23 + _m4storage[10] * m33; + final double t12 = _m4storage[3] * m13 + _m4storage[7] * m23 + _m4storage[11] * m33; _m4storage[0] = t1; _m4storage[1] = t2; _m4storage[2] = t3; @@ -1156,34 +1110,20 @@ class Matrix4 { /// Returns the determinant of this matrix. double determinant() { - final double det2_01_01 = - _m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]; - final double det2_01_02 = - _m4storage[0] * _m4storage[6] - _m4storage[2] * _m4storage[4]; - final double det2_01_03 = - _m4storage[0] * _m4storage[7] - _m4storage[3] * _m4storage[4]; - final double det2_01_12 = - _m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]; - final double det2_01_13 = - _m4storage[1] * _m4storage[7] - _m4storage[3] * _m4storage[5]; - final double det2_01_23 = - _m4storage[2] * _m4storage[7] - _m4storage[3] * _m4storage[6]; + final double det2_01_01 = _m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]; + final double det2_01_02 = _m4storage[0] * _m4storage[6] - _m4storage[2] * _m4storage[4]; + final double det2_01_03 = _m4storage[0] * _m4storage[7] - _m4storage[3] * _m4storage[4]; + final double det2_01_12 = _m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]; + final double det2_01_13 = _m4storage[1] * _m4storage[7] - _m4storage[3] * _m4storage[5]; + final double det2_01_23 = _m4storage[2] * _m4storage[7] - _m4storage[3] * _m4storage[6]; final double det3_201_012 = - _m4storage[8] * det2_01_12 - - _m4storage[9] * det2_01_02 + - _m4storage[10] * det2_01_01; + _m4storage[8] * det2_01_12 - _m4storage[9] * det2_01_02 + _m4storage[10] * det2_01_01; final double det3_201_013 = - _m4storage[8] * det2_01_13 - - _m4storage[9] * det2_01_03 + - _m4storage[11] * det2_01_01; + _m4storage[8] * det2_01_13 - _m4storage[9] * det2_01_03 + _m4storage[11] * det2_01_01; final double det3_201_023 = - _m4storage[8] * det2_01_23 - - _m4storage[10] * det2_01_03 + - _m4storage[11] * det2_01_02; + _m4storage[8] * det2_01_23 - _m4storage[10] * det2_01_03 + _m4storage[11] * det2_01_02; final double det3_201_123 = - _m4storage[9] * det2_01_23 - - _m4storage[10] * det2_01_13 + - _m4storage[11] * det2_01_12; + _m4storage[9] * det2_01_23 - _m4storage[10] * det2_01_13 + _m4storage[11] * det2_01_12; return -det3_201_123 * _m4storage[12] + det3_201_023 * _m4storage[13] - det3_201_013 * _m4storage[14] + @@ -1416,8 +1356,7 @@ class Matrix4 { final double b09 = a21 * a32 - a22 * a31; 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; + final double det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (det == 0.0) { setFrom(arg); return 0.0; @@ -1457,33 +1396,15 @@ class Matrix4 { double kx; double ky; double kz; - ix = - invDet * - (_m4storage[5] * _m4storage[10] - _m4storage[6] * _m4storage[9]); - iy = - invDet * - (_m4storage[2] * _m4storage[9] - _m4storage[1] * _m4storage[10]); - iz = - invDet * - (_m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]); - jx = - invDet * - (_m4storage[6] * _m4storage[8] - _m4storage[4] * _m4storage[10]); - jy = - invDet * - (_m4storage[0] * _m4storage[10] - _m4storage[2] * _m4storage[8]); - jz = - invDet * - (_m4storage[2] * _m4storage[4] - _m4storage[0] * _m4storage[6]); - kx = - invDet * - (_m4storage[4] * _m4storage[9] - _m4storage[5] * _m4storage[8]); - ky = - invDet * - (_m4storage[1] * _m4storage[8] - _m4storage[0] * _m4storage[9]); - kz = - invDet * - (_m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]); + ix = invDet * (_m4storage[5] * _m4storage[10] - _m4storage[6] * _m4storage[9]); + iy = invDet * (_m4storage[2] * _m4storage[9] - _m4storage[1] * _m4storage[10]); + iz = invDet * (_m4storage[1] * _m4storage[6] - _m4storage[2] * _m4storage[5]); + jx = invDet * (_m4storage[6] * _m4storage[8] - _m4storage[4] * _m4storage[10]); + jy = invDet * (_m4storage[0] * _m4storage[10] - _m4storage[2] * _m4storage[8]); + jz = invDet * (_m4storage[2] * _m4storage[4] - _m4storage[0] * _m4storage[6]); + kx = invDet * (_m4storage[4] * _m4storage[9] - _m4storage[5] * _m4storage[8]); + ky = invDet * (_m4storage[1] * _m4storage[8] - _m4storage[0] * _m4storage[9]); + kz = invDet * (_m4storage[0] * _m4storage[5] - _m4storage[1] * _m4storage[4]); _m4storage[0] = ix; _m4storage[1] = iy; _m4storage[2] = iz; @@ -1570,85 +1491,37 @@ class Matrix4 { final double c4 = _m4storage[11]; final double d4 = _m4storage[15]; _m4storage[0] = - (b2 * (c3 * d4 - c4 * d3) - - c2 * (b3 * d4 - b4 * d3) + - d2 * (b3 * c4 - b4 * c3)) * - scale; + (b2 * (c3 * d4 - c4 * d3) - c2 * (b3 * d4 - b4 * d3) + d2 * (b3 * c4 - b4 * c3)) * scale; _m4storage[1] = - -(a2 * (c3 * d4 - c4 * d3) - - c2 * (a3 * d4 - a4 * d3) + - d2 * (a3 * c4 - a4 * c3)) * - scale; + -(a2 * (c3 * d4 - c4 * d3) - c2 * (a3 * d4 - a4 * d3) + d2 * (a3 * c4 - a4 * c3)) * scale; _m4storage[2] = - (a2 * (b3 * d4 - b4 * d3) - - b2 * (a3 * d4 - a4 * d3) + - d2 * (a3 * b4 - a4 * b3)) * - scale; + (a2 * (b3 * d4 - b4 * d3) - b2 * (a3 * d4 - a4 * d3) + d2 * (a3 * b4 - a4 * b3)) * scale; _m4storage[3] = - -(a2 * (b3 * c4 - b4 * c3) - - b2 * (a3 * c4 - a4 * c3) + - c2 * (a3 * b4 - a4 * b3)) * - scale; + -(a2 * (b3 * c4 - b4 * c3) - b2 * (a3 * c4 - a4 * c3) + c2 * (a3 * b4 - a4 * b3)) * scale; _m4storage[4] = - -(b1 * (c3 * d4 - c4 * d3) - - c1 * (b3 * d4 - b4 * d3) + - d1 * (b3 * c4 - b4 * c3)) * - scale; + -(b1 * (c3 * d4 - c4 * d3) - c1 * (b3 * d4 - b4 * d3) + d1 * (b3 * c4 - b4 * c3)) * scale; _m4storage[5] = - (a1 * (c3 * d4 - c4 * d3) - - c1 * (a3 * d4 - a4 * d3) + - d1 * (a3 * c4 - a4 * c3)) * - scale; + (a1 * (c3 * d4 - c4 * d3) - c1 * (a3 * d4 - a4 * d3) + d1 * (a3 * c4 - a4 * c3)) * scale; _m4storage[6] = - -(a1 * (b3 * d4 - b4 * d3) - - b1 * (a3 * d4 - a4 * d3) + - d1 * (a3 * b4 - a4 * b3)) * - scale; + -(a1 * (b3 * d4 - b4 * d3) - b1 * (a3 * d4 - a4 * d3) + d1 * (a3 * b4 - a4 * b3)) * scale; _m4storage[7] = - (a1 * (b3 * c4 - b4 * c3) - - b1 * (a3 * c4 - a4 * c3) + - c1 * (a3 * b4 - a4 * b3)) * - scale; + (a1 * (b3 * c4 - b4 * c3) - b1 * (a3 * c4 - a4 * c3) + c1 * (a3 * b4 - a4 * b3)) * scale; _m4storage[8] = - (b1 * (c2 * d4 - c4 * d2) - - c1 * (b2 * d4 - b4 * d2) + - d1 * (b2 * c4 - b4 * c2)) * - scale; + (b1 * (c2 * d4 - c4 * d2) - c1 * (b2 * d4 - b4 * d2) + d1 * (b2 * c4 - b4 * c2)) * scale; _m4storage[9] = - -(a1 * (c2 * d4 - c4 * d2) - - c1 * (a2 * d4 - a4 * d2) + - d1 * (a2 * c4 - a4 * c2)) * - scale; + -(a1 * (c2 * d4 - c4 * d2) - c1 * (a2 * d4 - a4 * d2) + d1 * (a2 * c4 - a4 * c2)) * scale; _m4storage[10] = - (a1 * (b2 * d4 - b4 * d2) - - b1 * (a2 * d4 - a4 * d2) + - d1 * (a2 * b4 - a4 * b2)) * - scale; + (a1 * (b2 * d4 - b4 * d2) - b1 * (a2 * d4 - a4 * d2) + d1 * (a2 * b4 - a4 * b2)) * scale; _m4storage[11] = - -(a1 * (b2 * c4 - b4 * c2) - - b1 * (a2 * c4 - a4 * c2) + - c1 * (a2 * b4 - a4 * b2)) * - scale; + -(a1 * (b2 * c4 - b4 * c2) - b1 * (a2 * c4 - a4 * c2) + c1 * (a2 * b4 - a4 * b2)) * scale; _m4storage[12] = - -(b1 * (c2 * d3 - c3 * d2) - - c1 * (b2 * d3 - b3 * d2) + - d1 * (b2 * c3 - b3 * c2)) * - scale; + -(b1 * (c2 * d3 - c3 * d2) - c1 * (b2 * d3 - b3 * d2) + d1 * (b2 * c3 - b3 * c2)) * scale; _m4storage[13] = - (a1 * (c2 * d3 - c3 * d2) - - c1 * (a2 * d3 - a3 * d2) + - d1 * (a2 * c3 - a3 * c2)) * - scale; + (a1 * (c2 * d3 - c3 * d2) - c1 * (a2 * d3 - a3 * d2) + d1 * (a2 * c3 - a3 * c2)) * scale; _m4storage[14] = - -(a1 * (b2 * d3 - b3 * d2) - - b1 * (a2 * d3 - a3 * d2) + - d1 * (a2 * b3 - a3 * b2)) * - scale; + -(a1 * (b2 * d3 - b3 * d2) - b1 * (a2 * d3 - a3 * d2) + d1 * (a2 * b3 - a3 * b2)) * scale; _m4storage[15] = - (a1 * (b2 * c3 - b3 * c2) - - b1 * (a2 * c3 - a3 * c2) + - c1 * (a2 * b3 - a3 * b2)) * - scale; + (a1 * (b2 * c3 - b3 * c2) - b1 * (a2 * c3 - a3 * c2) + c1 * (a2 * b3 - a3 * b2)) * scale; } /// Rotates [arg] by the absolute rotation of this @@ -2054,12 +1927,9 @@ class Matrix4 { /// Decomposes this into [translation], [rotation] and [scale] components. void decompose(Vector3 translation, Quaternion rotation, Vector3 scale) { final Vector3 v = _decomposeV ??= Vector3.zero(); - double sx = - (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length; - final double sy = - (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length; - final double sz = - (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length; + double sx = (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length; + final double sy = (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length; + final double sz = (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length; if (determinant() < 0) { sx = -sx; diff --git a/packages/vector_math/lib/src/vector_math_64/obb3.dart b/packages/vector_math/lib/src/vector_math_64/obb3.dart index 1c23f45..d2fa9d6 100644 --- a/packages/vector_math/lib/src/vector_math_64/obb3.dart +++ b/packages/vector_math/lib/src/vector_math_64/obb3.dart @@ -242,110 +242,71 @@ class Obb3 { _halfExtents[2] * _absR.entry(2, i); rb = other._halfExtents[i]; - if ((_t[0] * _r.entry(0, i) + - _t[1] * _r.entry(1, i) + - _t[2] * _r.entry(2, i)) - .abs() > + if ((_t[0] * _r.entry(0, i) + _t[1] * _r.entry(1, i) + _t[2] * _r.entry(2, i)).abs() > ra + rb) { return false; } } // Test axis L = A0 x B0 - ra = - _halfExtents[1] * _absR.entry(2, 0) + - _halfExtents[2] * _absR.entry(1, 0); - rb = - other._halfExtents[1] * _absR.entry(0, 2) + - other._halfExtents[2] * _absR.entry(0, 1); + ra = _halfExtents[1] * _absR.entry(2, 0) + _halfExtents[2] * _absR.entry(1, 0); + rb = other._halfExtents[1] * _absR.entry(0, 2) + other._halfExtents[2] * _absR.entry(0, 1); if ((_t[2] * _r.entry(1, 0) - _t[1] * _r.entry(2, 0)).abs() > ra + rb) { return false; } // Test axis L = A0 x B1 - ra = - _halfExtents[1] * _absR.entry(2, 1) + - _halfExtents[2] * _absR.entry(1, 1); - rb = - other._halfExtents[0] * _absR.entry(0, 2) + - other._halfExtents[2] * _absR.entry(0, 0); + ra = _halfExtents[1] * _absR.entry(2, 1) + _halfExtents[2] * _absR.entry(1, 1); + rb = other._halfExtents[0] * _absR.entry(0, 2) + other._halfExtents[2] * _absR.entry(0, 0); if ((_t[2] * _r.entry(1, 1) - _t[1] * _r.entry(2, 1)).abs() > ra + rb) { return false; } // Test axis L = A0 x B2 - ra = - _halfExtents[1] * _absR.entry(2, 2) + - _halfExtents[2] * _absR.entry(1, 2); - rb = - other._halfExtents[0] * _absR.entry(0, 1) + - other._halfExtents[1] * _absR.entry(0, 0); + ra = _halfExtents[1] * _absR.entry(2, 2) + _halfExtents[2] * _absR.entry(1, 2); + rb = other._halfExtents[0] * _absR.entry(0, 1) + other._halfExtents[1] * _absR.entry(0, 0); if ((_t[2] * _r.entry(1, 2) - _t[1] * _r.entry(2, 2)).abs() > ra + rb) { return false; } // Test axis L = A1 x B0 - ra = - _halfExtents[0] * _absR.entry(2, 0) + - _halfExtents[2] * _absR.entry(0, 0); - rb = - other._halfExtents[1] * _absR.entry(1, 2) + - other._halfExtents[2] * _absR.entry(1, 1); + ra = _halfExtents[0] * _absR.entry(2, 0) + _halfExtents[2] * _absR.entry(0, 0); + rb = other._halfExtents[1] * _absR.entry(1, 2) + other._halfExtents[2] * _absR.entry(1, 1); if ((_t[0] * _r.entry(2, 0) - _t[2] * _r.entry(0, 0)).abs() > ra + rb) { return false; } // Test axis L = A1 x B1 - ra = - _halfExtents[0] * _absR.entry(2, 1) + - _halfExtents[2] * _absR.entry(0, 1); - rb = - other._halfExtents[0] * _absR.entry(1, 2) + - other._halfExtents[2] * _absR.entry(1, 0); + ra = _halfExtents[0] * _absR.entry(2, 1) + _halfExtents[2] * _absR.entry(0, 1); + rb = other._halfExtents[0] * _absR.entry(1, 2) + other._halfExtents[2] * _absR.entry(1, 0); if ((_t[0] * _r.entry(2, 1) - _t[2] * _r.entry(0, 1)).abs() > ra + rb) { return false; } // Test axis L = A1 x B2 - ra = - _halfExtents[0] * _absR.entry(2, 2) + - _halfExtents[2] * _absR.entry(0, 2); - rb = - other._halfExtents[0] * _absR.entry(1, 1) + - other._halfExtents[1] * _absR.entry(1, 0); + ra = _halfExtents[0] * _absR.entry(2, 2) + _halfExtents[2] * _absR.entry(0, 2); + rb = other._halfExtents[0] * _absR.entry(1, 1) + other._halfExtents[1] * _absR.entry(1, 0); if ((_t[0] * _r.entry(2, 2) - _t[2] * _r.entry(0, 2)).abs() > ra + rb) { return false; } // Test axis L = A2 x B0 - ra = - _halfExtents[0] * _absR.entry(1, 0) + - _halfExtents[1] * _absR.entry(0, 0); - rb = - other._halfExtents[1] * _absR.entry(2, 2) + - other._halfExtents[2] * _absR.entry(2, 1); + ra = _halfExtents[0] * _absR.entry(1, 0) + _halfExtents[1] * _absR.entry(0, 0); + rb = other._halfExtents[1] * _absR.entry(2, 2) + other._halfExtents[2] * _absR.entry(2, 1); if ((_t[1] * _r.entry(0, 0) - _t[0] * _r.entry(1, 0)).abs() > ra + rb) { return false; } // Test axis L = A2 x B1 - ra = - _halfExtents[0] * _absR.entry(1, 1) + - _halfExtents[1] * _absR.entry(0, 1); - rb = - other._halfExtents[0] * _absR.entry(2, 2) + - other._halfExtents[2] * _absR.entry(2, 0); + ra = _halfExtents[0] * _absR.entry(1, 1) + _halfExtents[1] * _absR.entry(0, 1); + rb = other._halfExtents[0] * _absR.entry(2, 2) + other._halfExtents[2] * _absR.entry(2, 0); if ((_t[1] * _r.entry(0, 1) - _t[0] * _r.entry(1, 1)).abs() > ra + rb) { return false; } // Test axis L = A2 x B2 - ra = - _halfExtents[0] * _absR.entry(1, 2) + - _halfExtents[1] * _absR.entry(0, 2); - rb = - other._halfExtents[0] * _absR.entry(2, 1) + - other._halfExtents[1] * _absR.entry(2, 0); + ra = _halfExtents[0] * _absR.entry(1, 2) + _halfExtents[1] * _absR.entry(0, 2); + rb = other._halfExtents[0] * _absR.entry(2, 1) + other._halfExtents[1] * _absR.entry(2, 0); if ((_t[1] * _r.entry(0, 2) - _t[0] * _r.entry(1, 2)).abs() > ra + rb) { return false; } diff --git a/packages/vector_math/lib/src/vector_math_64/opengl.dart b/packages/vector_math/lib/src/vector_math_64/opengl.dart index 79f1295..132dad8 100644 --- a/packages/vector_math/lib/src/vector_math_64/opengl.dart +++ b/packages/vector_math/lib/src/vector_math_64/opengl.dart @@ -40,11 +40,7 @@ part of '../../vector_math_64.dart'; /// gl.uniformMatrix4fv(u_MV, false, _MV.storage); /// } /// } -void setRotationMatrix( - Matrix4 rotationMatrix, - Vector3 forwardDirection, - Vector3 upDirection, -) { +void setRotationMatrix(Matrix4 rotationMatrix, Vector3 forwardDirection, Vector3 upDirection) { setModelMatrix(rotationMatrix, forwardDirection, upDirection, 0.0, 0.0, 0.0); } @@ -136,11 +132,7 @@ void setViewMatrix( /// [cameraPosition] specifies the position of the camera. /// [cameraFocusPosition] specifies the position the camera is focused on. /// [upDirection] specifies the direction of the up vector (usually, +Y). -Matrix4 makeViewMatrix( - Vector3 cameraPosition, - Vector3 cameraFocusPosition, - Vector3 upDirection, -) { +Matrix4 makeViewMatrix(Vector3 cameraPosition, Vector3 cameraFocusPosition, Vector3 upDirection) { final r = Matrix4.zero(); setViewMatrix(r, cameraPosition, cameraFocusPosition, upDirection); return r; @@ -186,12 +178,7 @@ void setPerspectiveMatrix( /// (always positive). /// [zFar] specifies the distance from the viewer to the far plane /// (always positive). -Matrix4 makePerspectiveMatrix( - double fovYRadians, - double aspectRatio, - double zNear, - double zFar, -) { +Matrix4 makePerspectiveMatrix(double fovYRadians, double aspectRatio, double zNear, double zFar) { final r = Matrix4.zero(); setPerspectiveMatrix(r, fovYRadians, aspectRatio, zNear, zFar); return r; @@ -230,11 +217,7 @@ void setInfiniteMatrix( /// in the x direction. The aspect ratio of x (width) to y (height). /// [zNear] specifies the distance from the viewer to the near plane /// (always positive). -Matrix4 makeInfiniteMatrix( - double fovYRadians, - double aspectRatio, - double zNear, -) { +Matrix4 makeInfiniteMatrix(double fovYRadians, double aspectRatio, double zNear) { final r = Matrix4.zero(); setInfiniteMatrix(r, fovYRadians, aspectRatio, zNear); return r; @@ -351,24 +334,12 @@ Matrix4 makeOrthographicMatrix( /// Returns a transformation matrix that transforms points onto /// the plane specified with [planeNormal] and [planePoint]. Matrix4 makePlaneProjection(Vector3 planeNormal, Vector3 planePoint) { - final v = Vector4( - planeNormal.storage[0], - planeNormal.storage[1], - planeNormal.storage[2], - 0.0, - ); + final v = Vector4(planeNormal.storage[0], planeNormal.storage[1], planeNormal.storage[2], 0.0); final outer = Matrix4.outer(v, v); var r = Matrix4.zero(); r = r - outer; - final Vector3 scaledNormal = planeNormal.scaled( - dot3(planePoint, planeNormal), - ); - final T = Vector4( - scaledNormal.storage[0], - scaledNormal.storage[1], - scaledNormal.storage[2], - 1.0, - ); + final Vector3 scaledNormal = planeNormal.scaled(dot3(planePoint, planeNormal)); + final T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1], scaledNormal.storage[2], 1.0); r.setColumn(3, T); return r; } @@ -376,23 +347,13 @@ Matrix4 makePlaneProjection(Vector3 planeNormal, Vector3 planePoint) { /// Returns a transformation matrix that transforms points by reflecting /// them through the plane specified with [planeNormal] and [planePoint]. Matrix4 makePlaneReflection(Vector3 planeNormal, Vector3 planePoint) { - final v = Vector4( - planeNormal.storage[0], - planeNormal.storage[1], - planeNormal.storage[2], - 0.0, - ); + final v = Vector4(planeNormal.storage[0], planeNormal.storage[1], planeNormal.storage[2], 0.0); final outer = Matrix4.outer(v, v)..scaleByDouble(2.0, 2.0, 2.0, 1.0); var r = Matrix4.zero(); r = r - outer; final double scale = 2.0 * planePoint.dot(planeNormal); final Vector3 scaledNormal = planeNormal.scaled(scale); - final T = Vector4( - scaledNormal.storage[0], - scaledNormal.storage[1], - scaledNormal.storage[2], - 1.0, - ); + final T = Vector4(scaledNormal.storage[0], scaledNormal.storage[1], scaledNormal.storage[2], 1.0); r.setColumn(3, T); return r; } @@ -432,12 +393,7 @@ bool unproject( pickZ = (2.0 * pickZ) - 1.0; // Check if pick point is inside unit cube - if (pickX < -1.0 || - pickY < -1.0 || - pickX > 1.0 || - pickY > 1.0 || - pickZ < -1.0 || - pickZ > 1.0) { + if (pickX < -1.0 || pickY < -1.0 || pickX > 1.0 || pickY > 1.0 || pickZ < -1.0 || pickZ > 1.0) { return false; } diff --git a/packages/vector_math/lib/src/vector_math_64/plane.dart b/packages/vector_math/lib/src/vector_math_64/plane.dart index 4301c25..61a9a18 100644 --- a/packages/vector_math/lib/src/vector_math_64/plane.dart +++ b/packages/vector_math/lib/src/vector_math_64/plane.dart @@ -11,15 +11,11 @@ part of '../../vector_math_64.dart'; class Plane { Plane() : _normal = Vector3.zero(), constant = 0.0; - Plane.copy(Plane other) - : _normal = Vector3.copy(other._normal), - constant = other.constant; + Plane.copy(Plane other) : _normal = Vector3.copy(other._normal), constant = other.constant; - Plane.components(double x, double y, double z, this.constant) - : _normal = Vector3(x, y, z); + Plane.components(double x, double y, double z, this.constant) : _normal = Vector3(x, y, z); - Plane.normalconstant(Vector3 normal_, this.constant) - : _normal = Vector3.copy(normal_); + Plane.normalconstant(Vector3 normal_, this.constant) : _normal = Vector3.copy(normal_); final Vector3 _normal; double constant; diff --git a/packages/vector_math/lib/src/vector_math_64/quaternion.dart b/packages/vector_math/lib/src/vector_math_64/quaternion.dart index 7edca5d..a1f72b5 100644 --- a/packages/vector_math/lib/src/vector_math_64/quaternion.dart +++ b/packages/vector_math/lib/src/vector_math_64/quaternion.dart @@ -30,8 +30,7 @@ class Quaternion { Quaternion._()..setFromTwoVectors(a, b); /// Constructs a quaternion as a copy of [original]. - factory Quaternion.copy(Quaternion original) => - Quaternion._()..setFrom(original); + factory Quaternion.copy(Quaternion original) => Quaternion._()..setFrom(original); /// Constructs a quaternion with a random rotation. The random number /// generator [rn] is used to generate the random numbers for the rotation. @@ -42,8 +41,7 @@ class Quaternion { /// Constructs a quaternion from time derivative of [q] with angular /// velocity [omega]. - factory Quaternion.dq(Quaternion q, Vector3 omega) => - Quaternion._()..setDQ(q, omega); + factory Quaternion.dq(Quaternion q, Vector3 omega) => Quaternion._()..setDQ(q, omega); /// Constructs a quaternion from [yaw], [pitch] and [roll]. factory Quaternion.euler(double yaw, double pitch, double roll) => @@ -315,11 +313,7 @@ class Quaternion { } final double scale = 1.0 / math.sqrt(den); - return Vector3( - _qStorage[0] * scale, - _qStorage[1] * scale, - _qStorage[2] * scale, - ); + return Vector3(_qStorage[0] * scale, _qStorage[1] * scale, _qStorage[2] * scale); } /// Length squared. diff --git a/packages/vector_math/lib/src/vector_math_64/sphere.dart b/packages/vector_math/lib/src/vector_math_64/sphere.dart index 4cc157d..d60cbf2 100644 --- a/packages/vector_math/lib/src/vector_math_64/sphere.dart +++ b/packages/vector_math/lib/src/vector_math_64/sphere.dart @@ -10,13 +10,10 @@ class Sphere { Sphere() : _center = Vector3.zero(), radius = 0.0; /// Create a sphere as a copy of [other]. - Sphere.copy(Sphere other) - : _center = Vector3.copy(other._center), - radius = other.radius; + Sphere.copy(Sphere other) : _center = Vector3.copy(other._center), radius = other.radius; /// Create a sphere from a [center] and a [radius]. - Sphere.centerRadius(Vector3 center, this.radius) - : _center = Vector3.copy(center); + Sphere.centerRadius(Vector3 center, this.radius) : _center = Vector3.copy(center); final Vector3 _center; /// The [radius] of the sphere. @@ -32,12 +29,10 @@ class Sphere { } /// Return if this contains [other]. - bool containsVector3(Vector3 other) => - other.distanceToSquared(center) < radius * radius; + bool containsVector3(Vector3 other) => other.distanceToSquared(center) < radius * radius; /// Return if this intersects with [other]. - bool intersectsWithVector3(Vector3 other) => - other.distanceToSquared(center) <= radius * radius; + bool intersectsWithVector3(Vector3 other) => other.distanceToSquared(center) <= radius * radius; /// Return if this intersects with [other]. bool intersectsWithSphere(Sphere other) { diff --git a/packages/vector_math/lib/src/vector_math_64/triangle.dart b/packages/vector_math/lib/src/vector_math_64/triangle.dart index c92b1c6..f6bbacd 100644 --- a/packages/vector_math/lib/src/vector_math_64/triangle.dart +++ b/packages/vector_math/lib/src/vector_math_64/triangle.dart @@ -7,10 +7,7 @@ part of '../../vector_math_64.dart'; /// Defines a triangle by three points. class Triangle { /// Create a new, uninitialized triangle. - Triangle() - : _point0 = Vector3.zero(), - _point1 = Vector3.zero(), - _point2 = Vector3.zero(); + Triangle() : _point0 = Vector3.zero(), _point1 = Vector3.zero(), _point2 = Vector3.zero(); /// Create a triangle as a copy of [other]. Triangle.copy(Triangle other) diff --git a/packages/vector_math/lib/src/vector_math_64/utilities.dart b/packages/vector_math/lib/src/vector_math_64/utilities.dart index 13b7b99..32b7b21 100644 --- a/packages/vector_math/lib/src/vector_math_64/utilities.dart +++ b/packages/vector_math/lib/src/vector_math_64/utilities.dart @@ -25,16 +25,9 @@ double smoothStep(double edge0, double edge1, double amount) { /// Do a catmull rom spline interpolation with [edge0], [edge1], [edge2] and /// [edge3] by [amount]. -double catmullRom( - double edge0, - double edge1, - double edge2, - double edge3, - double amount, -) => +double catmullRom(double edge0, double edge1, double edge2, double edge3, double amount) => 0.5 * ((2.0 * edge1) + (-edge0 + edge2) * amount + (2.0 * edge0 - 5.0 * edge1 + 4.0 * edge2 - edge3) * (amount * amount) + - (-edge0 + 3.0 * edge1 - 3.0 * edge2 + edge3) * - (amount * amount * amount)); + (-edge0 + 3.0 * edge1 - 3.0 * edge2 + edge3) * (amount * amount * amount)); diff --git a/packages/vector_math/lib/src/vector_math_64/vector.dart b/packages/vector_math/lib/src/vector_math_64/vector.dart index a709b5a..2224619 100644 --- a/packages/vector_math/lib/src/vector_math_64/vector.dart +++ b/packages/vector_math/lib/src/vector_math_64/vector.dart @@ -39,8 +39,7 @@ void cross2B(Vector2 x, double y, Vector2 out) { void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { if (planeNormal.z.abs() > math.sqrt1_2) { // choose u in y-z plane - final double a = - planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; + final double a = planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; final double k = 1.0 / math.sqrt(a); u ..x = 0.0 @@ -53,8 +52,7 @@ void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { ..z = planeNormal[0] * (-planeNormal[2] * k); } else { // choose u in x-y plane - final double a = - planeNormal.x * planeNormal.x + planeNormal.y * planeNormal.y; + final double a = planeNormal.x * planeNormal.x + planeNormal.y * planeNormal.y; final double k = 1.0 / math.sqrt(a); u ..x = -planeNormal[1] * k diff --git a/packages/vector_math/lib/src/vector_math_64/vector2.dart b/packages/vector_math/lib/src/vector_math_64/vector2.dart index e5de199..1ba3f85 100644 --- a/packages/vector_math/lib/src/vector_math_64/vector2.dart +++ b/packages/vector_math/lib/src/vector_math_64/vector2.dart @@ -151,8 +151,7 @@ class Vector2 implements Vector { double get length => math.sqrt(length2); /// The squared length of the vector. - double get length2 => - _v2storage[1] * _v2storage[1] + _v2storage[0] * _v2storage[0]; + double get length2 => _v2storage[1] * _v2storage[1] + _v2storage[0] * _v2storage[0]; /// Normalize this. double normalize() { @@ -261,8 +260,7 @@ class Vector2 implements Vector { Vector2 reflected(Vector2 normal) => clone()..reflect(normal); /// Relative error between this and [correct] - double relativeError(Vector2 correct) => - absoluteError(correct) / correct.length; + double relativeError(Vector2 correct) => absoluteError(correct) / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector2 correct) { @@ -432,38 +430,22 @@ class Vector2 implements Vector { Vector3 get yxy => Vector3(_v2storage[1], _v2storage[0], _v2storage[1]); Vector3 get yyx => Vector3(_v2storage[1], _v2storage[1], _v2storage[0]); Vector3 get yyy => Vector3(_v2storage[1], _v2storage[1], _v2storage[1]); - Vector4 get xxxx => - Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[0]); - Vector4 get xxxy => - Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[1]); - Vector4 get xxyx => - Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[0]); - Vector4 get xxyy => - Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[1]); - Vector4 get xyxx => - Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[0]); - Vector4 get xyxy => - Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[1]); - Vector4 get xyyx => - Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[0]); - Vector4 get xyyy => - Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[1]); - Vector4 get yxxx => - Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[0]); - Vector4 get yxxy => - Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[1]); - Vector4 get yxyx => - Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[0]); - Vector4 get yxyy => - Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[1]); - Vector4 get yyxx => - Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[0]); - Vector4 get yyxy => - Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[1]); - Vector4 get yyyx => - Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[0]); - Vector4 get yyyy => - Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[1]); + Vector4 get xxxx => Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[0]); + Vector4 get xxxy => Vector4(_v2storage[0], _v2storage[0], _v2storage[0], _v2storage[1]); + Vector4 get xxyx => Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[0]); + Vector4 get xxyy => Vector4(_v2storage[0], _v2storage[0], _v2storage[1], _v2storage[1]); + Vector4 get xyxx => Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[0]); + Vector4 get xyxy => Vector4(_v2storage[0], _v2storage[1], _v2storage[0], _v2storage[1]); + Vector4 get xyyx => Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[0]); + Vector4 get xyyy => Vector4(_v2storage[0], _v2storage[1], _v2storage[1], _v2storage[1]); + Vector4 get yxxx => Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[0]); + Vector4 get yxxy => Vector4(_v2storage[1], _v2storage[0], _v2storage[0], _v2storage[1]); + Vector4 get yxyx => Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[0]); + Vector4 get yxyy => Vector4(_v2storage[1], _v2storage[0], _v2storage[1], _v2storage[1]); + Vector4 get yyxx => Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[0]); + Vector4 get yyxy => Vector4(_v2storage[1], _v2storage[1], _v2storage[0], _v2storage[1]); + Vector4 get yyyx => Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[0]); + Vector4 get yyyy => Vector4(_v2storage[1], _v2storage[1], _v2storage[1], _v2storage[1]); double get r => x; double get g => y; double get s => x; diff --git a/packages/vector_math/lib/src/vector_math_64/vector3.dart b/packages/vector_math/lib/src/vector_math_64/vector3.dart index 7edcdaa..b1341d2 100644 --- a/packages/vector_math/lib/src/vector_math_64/vector3.dart +++ b/packages/vector_math/lib/src/vector_math_64/vector3.dart @@ -10,8 +10,7 @@ part of '../../vector_math_64.dart'; /// 3D column vector. class Vector3 implements Vector { /// Construct a new vector with the specified values. - factory Vector3(double x, double y, double z) => - Vector3.zero()..setValues(x, y, z); + factory Vector3(double x, double y, double z) => Vector3.zero()..setValues(x, y, z); /// Initialized with values from [array] starting at [offset]. factory Vector3.array(List array, [int offset = 0]) => @@ -253,12 +252,9 @@ class Vector3 implements Vector { final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - v0 * argStorage[6] + v1 * argStorage[7] + v2 * argStorage[8]; - _v3storage[1] = - v0 * argStorage[3] + v1 * argStorage[4] + v2 * argStorage[5]; - _v3storage[0] = - v0 * argStorage[0] + v1 * argStorage[1] + v2 * argStorage[2]; + _v3storage[2] = v0 * argStorage[6] + v1 * argStorage[7] + v2 * argStorage[8]; + _v3storage[1] = v0 * argStorage[3] + v1 * argStorage[4] + v2 * argStorage[5]; + _v3storage[0] = v0 * argStorage[0] + v1 * argStorage[1] + v2 * argStorage[2]; } /// Cross product. @@ -307,29 +303,13 @@ class Vector3 implements Vector { final double y = _v3storage[1]; final double x = _v3storage[0]; final double d = - 1.0 / - (argStorage[15] + - argStorage[11] * z + - argStorage[7] * y + - argStorage[3] * x); + 1.0 / (argStorage[15] + argStorage[11] * z + argStorage[7] * y + argStorage[3] * x); _v3storage[0] = - (argStorage[12] + - argStorage[8] * z + - argStorage[4] * y + - argStorage[0] * x) * - d; + (argStorage[12] + argStorage[8] * z + argStorage[4] * y + argStorage[0] * x) * d; _v3storage[1] = - (argStorage[13] + - argStorage[9] * z + - argStorage[5] * y + - argStorage[1] * x) * - d; + (argStorage[13] + argStorage[9] * z + argStorage[5] * y + argStorage[1] * x) * d; _v3storage[2] = - (argStorage[14] + - argStorage[10] * z + - argStorage[6] * y + - argStorage[2] * x) * - d; + (argStorage[14] + argStorage[10] * z + argStorage[6] * y + argStorage[2] * x) * d; } /// Applies a rotation specified by [axis] and [angle]. @@ -362,12 +342,9 @@ class Vector3 implements Vector { final double v2 = _v3storage[2]; final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - argStorage[2] * v0 + argStorage[5] * v1 + argStorage[8] * v2; - _v3storage[1] = - argStorage[1] * v0 + argStorage[4] * v1 + argStorage[7] * v2; - _v3storage[0] = - argStorage[0] * v0 + argStorage[3] * v1 + argStorage[6] * v2; + _v3storage[2] = argStorage[2] * v0 + argStorage[5] * v1 + argStorage[8] * v2; + _v3storage[1] = argStorage[1] * v0 + argStorage[4] * v1 + argStorage[7] * v2; + _v3storage[0] = argStorage[0] * v0 + argStorage[3] * v1 + argStorage[6] * v2; } /// Multiplies this by a 4x3 subset of [arg]. Expects [arg] to be an affine @@ -377,26 +354,13 @@ class Vector3 implements Vector { final double v2 = _v3storage[2]; final double v1 = _v3storage[1]; final double v0 = _v3storage[0]; - _v3storage[2] = - argStorage[2] * v0 + - argStorage[6] * v1 + - argStorage[10] * v2 + - argStorage[14]; - _v3storage[1] = - argStorage[1] * v0 + - argStorage[5] * v1 + - argStorage[9] * v2 + - argStorage[13]; - _v3storage[0] = - argStorage[0] * v0 + - argStorage[4] * v1 + - argStorage[8] * v2 + - argStorage[12]; + _v3storage[2] = argStorage[2] * v0 + argStorage[6] * v1 + argStorage[10] * v2 + argStorage[14]; + _v3storage[1] = argStorage[1] * v0 + argStorage[5] * v1 + argStorage[9] * v2 + argStorage[13]; + _v3storage[0] = argStorage[0] * v0 + argStorage[4] * v1 + argStorage[8] * v2 + argStorage[12]; } /// Relative error between this and [correct] - double relativeError(Vector3 correct) => - absoluteError(correct) / correct.length; + double relativeError(Vector3 correct) => absoluteError(correct) / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector3 correct) { @@ -408,13 +372,10 @@ class Vector3 implements Vector { /// True if any component is infinite. bool get isInfinite => - _v3storage[2].isInfinite || - _v3storage[1].isInfinite || - _v3storage[0].isInfinite; + _v3storage[2].isInfinite || _v3storage[1].isInfinite || _v3storage[0].isInfinite; /// True if any component is NaN. - bool get isNaN => - _v3storage[2].isNaN || _v3storage[1].isNaN || _v3storage[0].isNaN; + bool get isNaN => _v3storage[2].isNaN || _v3storage[1].isNaN || _v3storage[0].isNaN; /// Add [arg] to this. void add(Vector3 arg) { @@ -703,168 +664,87 @@ class Vector3 implements Vector { Vector3 get zzx => Vector3(_v3storage[2], _v3storage[2], _v3storage[0]); Vector3 get zzy => Vector3(_v3storage[2], _v3storage[2], _v3storage[1]); Vector3 get zzz => Vector3(_v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get xxxx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get xxxy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get xxxz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get xxyx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get xxyy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get xxyz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get xxzx => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get xxzy => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get xxzz => - Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get xyxx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get xyxy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get xyxz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get xyyx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get xyyy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get xyyz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get xyzx => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get xyzy => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get xyzz => - Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get xzxx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get xzxy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get xzxz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get xzyx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get xzyy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get xzyz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get xzzx => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get xzzy => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get xzzz => - Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get yxxx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get yxxy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get yxxz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get yxyx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get yxyy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get yxyz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get yxzx => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get yxzy => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get yxzz => - Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get yyxx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get yyxy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get yyxz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get yyyx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get yyyy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get yyyz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get yyzx => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get yyzy => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get yyzz => - Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get yzxx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get yzxy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get yzxz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get yzyx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get yzyy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get yzyz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get yzzx => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get yzzy => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get yzzz => - Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[2]); - Vector4 get zxxx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[0]); - Vector4 get zxxy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[1]); - Vector4 get zxxz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[2]); - Vector4 get zxyx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[0]); - Vector4 get zxyy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[1]); - Vector4 get zxyz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[2]); - Vector4 get zxzx => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[0]); - Vector4 get zxzy => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[1]); - Vector4 get zxzz => - Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[2]); - Vector4 get zyxx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[0]); - Vector4 get zyxy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[1]); - Vector4 get zyxz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[2]); - Vector4 get zyyx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[0]); - Vector4 get zyyy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[1]); - Vector4 get zyyz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[2]); - Vector4 get zyzx => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[0]); - Vector4 get zyzy => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[1]); - Vector4 get zyzz => - Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[2]); - Vector4 get zzxx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[0]); - Vector4 get zzxy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[1]); - Vector4 get zzxz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[2]); - Vector4 get zzyx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[0]); - Vector4 get zzyy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[1]); - Vector4 get zzyz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[2]); - Vector4 get zzzx => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[0]); - Vector4 get zzzy => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[1]); - Vector4 get zzzz => - Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get xxxx => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get xxxy => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get xxxz => Vector4(_v3storage[0], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get xxyx => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get xxyy => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get xxyz => Vector4(_v3storage[0], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get xxzx => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get xxzy => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get xxzz => Vector4(_v3storage[0], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get xyxx => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get xyxy => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get xyxz => Vector4(_v3storage[0], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get xyyx => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get xyyy => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get xyyz => Vector4(_v3storage[0], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get xyzx => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get xyzy => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get xyzz => Vector4(_v3storage[0], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get xzxx => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get xzxy => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get xzxz => Vector4(_v3storage[0], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get xzyx => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get xzyy => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get xzyz => Vector4(_v3storage[0], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get xzzx => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get xzzy => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get xzzz => Vector4(_v3storage[0], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get yxxx => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get yxxy => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get yxxz => Vector4(_v3storage[1], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get yxyx => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get yxyy => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get yxyz => Vector4(_v3storage[1], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get yxzx => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get yxzy => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get yxzz => Vector4(_v3storage[1], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get yyxx => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get yyxy => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get yyxz => Vector4(_v3storage[1], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get yyyx => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get yyyy => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get yyyz => Vector4(_v3storage[1], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get yyzx => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get yyzy => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get yyzz => Vector4(_v3storage[1], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get yzxx => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get yzxy => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get yzxz => Vector4(_v3storage[1], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get yzyx => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get yzyy => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get yzyz => Vector4(_v3storage[1], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get yzzx => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get yzzy => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get yzzz => Vector4(_v3storage[1], _v3storage[2], _v3storage[2], _v3storage[2]); + Vector4 get zxxx => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[0]); + Vector4 get zxxy => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[1]); + Vector4 get zxxz => Vector4(_v3storage[2], _v3storage[0], _v3storage[0], _v3storage[2]); + Vector4 get zxyx => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[0]); + Vector4 get zxyy => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[1]); + Vector4 get zxyz => Vector4(_v3storage[2], _v3storage[0], _v3storage[1], _v3storage[2]); + Vector4 get zxzx => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[0]); + Vector4 get zxzy => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[1]); + Vector4 get zxzz => Vector4(_v3storage[2], _v3storage[0], _v3storage[2], _v3storage[2]); + Vector4 get zyxx => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[0]); + Vector4 get zyxy => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[1]); + Vector4 get zyxz => Vector4(_v3storage[2], _v3storage[1], _v3storage[0], _v3storage[2]); + Vector4 get zyyx => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[0]); + Vector4 get zyyy => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[1]); + Vector4 get zyyz => Vector4(_v3storage[2], _v3storage[1], _v3storage[1], _v3storage[2]); + Vector4 get zyzx => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[0]); + Vector4 get zyzy => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[1]); + Vector4 get zyzz => Vector4(_v3storage[2], _v3storage[1], _v3storage[2], _v3storage[2]); + Vector4 get zzxx => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[0]); + Vector4 get zzxy => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[1]); + Vector4 get zzxz => Vector4(_v3storage[2], _v3storage[2], _v3storage[0], _v3storage[2]); + Vector4 get zzyx => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[0]); + Vector4 get zzyy => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[1]); + Vector4 get zzyz => Vector4(_v3storage[2], _v3storage[2], _v3storage[1], _v3storage[2]); + Vector4 get zzzx => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[0]); + Vector4 get zzzy => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[1]); + Vector4 get zzzz => Vector4(_v3storage[2], _v3storage[2], _v3storage[2], _v3storage[2]); double get r => x; double get g => y; double get b => z; diff --git a/packages/vector_math/lib/src/vector_math_64/vector4.dart b/packages/vector_math/lib/src/vector_math_64/vector4.dart index 72c089a..dc0be72 100644 --- a/packages/vector_math/lib/src/vector_math_64/vector4.dart +++ b/packages/vector_math/lib/src/vector_math_64/vector4.dart @@ -10,8 +10,7 @@ part of '../../vector_math_64.dart'; /// 4D column vector. class Vector4 implements Vector { /// Construct a new vector with the specified values. - factory Vector4(double x, double y, double z, double w) => - Vector4.zero()..setValues(x, y, z, w); + factory Vector4(double x, double y, double z, double w) => Vector4.zero()..setValues(x, y, z, w); /// Initialized with values from [array] starting at [offset]. factory Vector4.array(List array, [int offset = 0]) => @@ -41,12 +40,7 @@ class Vector4 implements Vector { /// optionally pass your own random number generator. factory Vector4.random([math.Random? rng]) { rng ??= math.Random(); - return Vector4( - rng.nextDouble(), - rng.nextDouble(), - rng.nextDouble(), - rng.nextDouble(), - ); + return Vector4(rng.nextDouble(), rng.nextDouble(), rng.nextDouble(), rng.nextDouble()); } final Float64List _v4storage; @@ -254,30 +248,17 @@ class Vector4 implements Vector { final double v1 = _v4storage[0]; final Float64List argStorage = arg._m4storage; _v4storage[3] = - argStorage[3] * v1 + - argStorage[7] * v2 + - argStorage[11] * v3 + - argStorage[15] * v4; + argStorage[3] * v1 + argStorage[7] * v2 + argStorage[11] * v3 + argStorage[15] * v4; _v4storage[2] = - argStorage[2] * v1 + - argStorage[6] * v2 + - argStorage[10] * v3 + - argStorage[14] * v4; + argStorage[2] * v1 + argStorage[6] * v2 + argStorage[10] * v3 + argStorage[14] * v4; _v4storage[1] = - argStorage[1] * v1 + - argStorage[5] * v2 + - argStorage[9] * v3 + - argStorage[13] * v4; + argStorage[1] * v1 + argStorage[5] * v2 + argStorage[9] * v3 + argStorage[13] * v4; _v4storage[0] = - argStorage[0] * v1 + - argStorage[4] * v2 + - argStorage[8] * v3 + - argStorage[12] * v4; + argStorage[0] * v1 + argStorage[4] * v2 + argStorage[8] * v3 + argStorage[12] * v4; } /// Relative error between this and [correct] - double relativeError(Vector4 correct) => - (this - correct).length / correct.length; + double relativeError(Vector4 correct) => (this - correct).length / correct.length; /// Absolute error between this and [correct] double absoluteError(Vector4 correct) { @@ -285,9 +266,7 @@ class Vector4 implements Vector { final double zDiff = _v4storage[2] - correct._v4storage[2]; final double yDiff = _v4storage[1] - correct._v4storage[1]; final double xDiff = _v4storage[0] - correct._v4storage[0]; - return math.sqrt( - xDiff * xDiff + yDiff * yDiff + zDiff * zDiff + wDiff * wDiff, - ); + return math.sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff + wDiff * wDiff); } /// True if any component is infinite. @@ -299,10 +278,7 @@ class Vector4 implements Vector { /// True if any component is NaN. bool get isNaN => - _v4storage[3].isNaN || - _v4storage[2].isNaN || - _v4storage[1].isNaN || - _v4storage[0].isNaN; + _v4storage[3].isNaN || _v4storage[2].isNaN || _v4storage[1].isNaN || _v4storage[0].isNaN; void add(Vector4 arg) { final Float64List argStorage = arg._v4storage; @@ -1106,518 +1082,262 @@ class Vector4 implements Vector { Vector3 get wwy => Vector3(_v4storage[3], _v4storage[3], _v4storage[1]); Vector3 get wwz => Vector3(_v4storage[3], _v4storage[3], _v4storage[2]); Vector3 get www => Vector3(_v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get xxxx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get xxxy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get xxxz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get xxxw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get xxyx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get xxyy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get xxyz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get xxyw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get xxzx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get xxzy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get xxzz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get xxzw => - Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get xxwx => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get xxwy => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get xxwz => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get xxww => - Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get xyxx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get xyxy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get xyxz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get xyxw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get xyyx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get xyyy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get xyyz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get xyyw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get xyzx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get xyzy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get xyzz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get xyzw => - Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get xywx => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get xywy => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get xywz => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get xyww => - Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get xzxx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get xzxy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get xzxz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get xzxw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get xzyx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get xzyy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get xzyz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get xzyw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get xzzx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get xzzy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get xzzz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get xzzw => - Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get xzwx => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get xzwy => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get xzwz => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get xzww => - Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get xwxx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get xwxy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get xwxz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get xwxw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get xwyx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get xwyy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get xwyz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get xwyw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get xwzx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get xwzy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get xwzz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get xwzw => - Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get xwwx => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get xwwy => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get xwwz => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get xwww => - Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get yxxx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get yxxy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get yxxz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get yxxw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get yxyx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get yxyy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get yxyz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get yxyw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get yxzx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get yxzy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get yxzz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get yxzw => - Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get yxwx => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get yxwy => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get yxwz => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get yxww => - Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get yyxx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get yyxy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get yyxz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get yyxw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get yyyx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get yyyy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get yyyz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get yyyw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get yyzx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get yyzy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get yyzz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get yyzw => - Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get yywx => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get yywy => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get yywz => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get yyww => - Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get yzxx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get yzxy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get yzxz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get yzxw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get yzyx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get yzyy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get yzyz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get yzyw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get yzzx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get yzzy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get yzzz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get yzzw => - Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get yzwx => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get yzwy => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get yzwz => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get yzww => - Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get ywxx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get ywxy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get ywxz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get ywxw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get ywyx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get ywyy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get ywyz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get ywyw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get ywzx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get ywzy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get ywzz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get ywzw => - Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get ywwx => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get ywwy => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get ywwz => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get ywww => - Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get zxxx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get zxxy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get zxxz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get zxxw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get zxyx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get zxyy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get zxyz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get zxyw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get zxzx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get zxzy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get zxzz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get zxzw => - Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get zxwx => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get zxwy => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get zxwz => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get zxww => - Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get zyxx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get zyxy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get zyxz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get zyxw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get zyyx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get zyyy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get zyyz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get zyyw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get zyzx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get zyzy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get zyzz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get zyzw => - Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get zywx => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get zywy => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get zywz => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get zyww => - Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get zzxx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get zzxy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get zzxz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get zzxw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get zzyx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get zzyy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get zzyz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get zzyw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get zzzx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get zzzy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get zzzz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get zzzw => - Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get zzwx => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get zzwy => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get zzwz => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get zzww => - Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get zwxx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get zwxy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get zwxz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get zwxw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get zwyx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get zwyy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get zwyz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get zwyw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get zwzx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get zwzy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get zwzz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get zwzw => - Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get zwwx => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get zwwy => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get zwwz => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get zwww => - Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[3]); - Vector4 get wxxx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[0]); - Vector4 get wxxy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[1]); - Vector4 get wxxz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[2]); - Vector4 get wxxw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[3]); - Vector4 get wxyx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[0]); - Vector4 get wxyy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[1]); - Vector4 get wxyz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[2]); - Vector4 get wxyw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[3]); - Vector4 get wxzx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[0]); - Vector4 get wxzy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[1]); - Vector4 get wxzz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[2]); - Vector4 get wxzw => - Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[3]); - Vector4 get wxwx => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[0]); - Vector4 get wxwy => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[1]); - Vector4 get wxwz => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[2]); - Vector4 get wxww => - Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[3]); - Vector4 get wyxx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[0]); - Vector4 get wyxy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[1]); - Vector4 get wyxz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[2]); - Vector4 get wyxw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[3]); - Vector4 get wyyx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[0]); - Vector4 get wyyy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[1]); - Vector4 get wyyz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[2]); - Vector4 get wyyw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[3]); - Vector4 get wyzx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[0]); - Vector4 get wyzy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[1]); - Vector4 get wyzz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[2]); - Vector4 get wyzw => - Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[3]); - Vector4 get wywx => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[0]); - Vector4 get wywy => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[1]); - Vector4 get wywz => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[2]); - Vector4 get wyww => - Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[3]); - Vector4 get wzxx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[0]); - Vector4 get wzxy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[1]); - Vector4 get wzxz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[2]); - Vector4 get wzxw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[3]); - Vector4 get wzyx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[0]); - Vector4 get wzyy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[1]); - Vector4 get wzyz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[2]); - Vector4 get wzyw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[3]); - Vector4 get wzzx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[0]); - Vector4 get wzzy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[1]); - Vector4 get wzzz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[2]); - Vector4 get wzzw => - Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[3]); - Vector4 get wzwx => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[0]); - Vector4 get wzwy => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[1]); - Vector4 get wzwz => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[2]); - Vector4 get wzww => - Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[3]); - Vector4 get wwxx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[0]); - Vector4 get wwxy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[1]); - Vector4 get wwxz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[2]); - Vector4 get wwxw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[3]); - Vector4 get wwyx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[0]); - Vector4 get wwyy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[1]); - Vector4 get wwyz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[2]); - Vector4 get wwyw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[3]); - Vector4 get wwzx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[0]); - Vector4 get wwzy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[1]); - Vector4 get wwzz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[2]); - Vector4 get wwzw => - Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[3]); - Vector4 get wwwx => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[0]); - Vector4 get wwwy => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[1]); - Vector4 get wwwz => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[2]); - Vector4 get wwww => - Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get xxxx => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get xxxy => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get xxxz => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get xxxw => Vector4(_v4storage[0], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get xxyx => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get xxyy => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get xxyz => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get xxyw => Vector4(_v4storage[0], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get xxzx => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get xxzy => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get xxzz => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get xxzw => Vector4(_v4storage[0], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get xxwx => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get xxwy => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get xxwz => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get xxww => Vector4(_v4storage[0], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get xyxx => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get xyxy => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get xyxz => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get xyxw => Vector4(_v4storage[0], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get xyyx => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get xyyy => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get xyyz => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get xyyw => Vector4(_v4storage[0], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get xyzx => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get xyzy => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get xyzz => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get xyzw => Vector4(_v4storage[0], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get xywx => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get xywy => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get xywz => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get xyww => Vector4(_v4storage[0], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get xzxx => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get xzxy => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get xzxz => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get xzxw => Vector4(_v4storage[0], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get xzyx => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get xzyy => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get xzyz => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get xzyw => Vector4(_v4storage[0], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get xzzx => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get xzzy => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get xzzz => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get xzzw => Vector4(_v4storage[0], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get xzwx => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get xzwy => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get xzwz => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get xzww => Vector4(_v4storage[0], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get xwxx => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get xwxy => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get xwxz => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get xwxw => Vector4(_v4storage[0], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get xwyx => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get xwyy => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get xwyz => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get xwyw => Vector4(_v4storage[0], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get xwzx => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get xwzy => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get xwzz => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get xwzw => Vector4(_v4storage[0], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get xwwx => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get xwwy => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get xwwz => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get xwww => Vector4(_v4storage[0], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get yxxx => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get yxxy => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get yxxz => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get yxxw => Vector4(_v4storage[1], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get yxyx => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get yxyy => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get yxyz => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get yxyw => Vector4(_v4storage[1], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get yxzx => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get yxzy => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get yxzz => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get yxzw => Vector4(_v4storage[1], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get yxwx => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get yxwy => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get yxwz => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get yxww => Vector4(_v4storage[1], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get yyxx => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get yyxy => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get yyxz => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get yyxw => Vector4(_v4storage[1], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get yyyx => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get yyyy => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get yyyz => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get yyyw => Vector4(_v4storage[1], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get yyzx => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get yyzy => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get yyzz => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get yyzw => Vector4(_v4storage[1], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get yywx => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get yywy => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get yywz => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get yyww => Vector4(_v4storage[1], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get yzxx => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get yzxy => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get yzxz => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get yzxw => Vector4(_v4storage[1], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get yzyx => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get yzyy => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get yzyz => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get yzyw => Vector4(_v4storage[1], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get yzzx => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get yzzy => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get yzzz => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get yzzw => Vector4(_v4storage[1], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get yzwx => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get yzwy => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get yzwz => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get yzww => Vector4(_v4storage[1], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get ywxx => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get ywxy => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get ywxz => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get ywxw => Vector4(_v4storage[1], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get ywyx => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get ywyy => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get ywyz => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get ywyw => Vector4(_v4storage[1], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get ywzx => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get ywzy => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get ywzz => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get ywzw => Vector4(_v4storage[1], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get ywwx => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get ywwy => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get ywwz => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get ywww => Vector4(_v4storage[1], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get zxxx => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get zxxy => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get zxxz => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get zxxw => Vector4(_v4storage[2], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get zxyx => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get zxyy => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get zxyz => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get zxyw => Vector4(_v4storage[2], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get zxzx => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get zxzy => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get zxzz => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get zxzw => Vector4(_v4storage[2], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get zxwx => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get zxwy => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get zxwz => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get zxww => Vector4(_v4storage[2], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get zyxx => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get zyxy => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get zyxz => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get zyxw => Vector4(_v4storage[2], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get zyyx => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get zyyy => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get zyyz => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get zyyw => Vector4(_v4storage[2], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get zyzx => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get zyzy => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get zyzz => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get zyzw => Vector4(_v4storage[2], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get zywx => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get zywy => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get zywz => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get zyww => Vector4(_v4storage[2], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get zzxx => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get zzxy => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get zzxz => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get zzxw => Vector4(_v4storage[2], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get zzyx => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get zzyy => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get zzyz => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get zzyw => Vector4(_v4storage[2], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get zzzx => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get zzzy => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get zzzz => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get zzzw => Vector4(_v4storage[2], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get zzwx => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get zzwy => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get zzwz => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get zzww => Vector4(_v4storage[2], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get zwxx => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get zwxy => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get zwxz => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get zwxw => Vector4(_v4storage[2], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get zwyx => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get zwyy => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get zwyz => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get zwyw => Vector4(_v4storage[2], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get zwzx => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get zwzy => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get zwzz => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get zwzw => Vector4(_v4storage[2], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get zwwx => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get zwwy => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get zwwz => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get zwww => Vector4(_v4storage[2], _v4storage[3], _v4storage[3], _v4storage[3]); + Vector4 get wxxx => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[0]); + Vector4 get wxxy => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[1]); + Vector4 get wxxz => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[2]); + Vector4 get wxxw => Vector4(_v4storage[3], _v4storage[0], _v4storage[0], _v4storage[3]); + Vector4 get wxyx => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[0]); + Vector4 get wxyy => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[1]); + Vector4 get wxyz => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[2]); + Vector4 get wxyw => Vector4(_v4storage[3], _v4storage[0], _v4storage[1], _v4storage[3]); + Vector4 get wxzx => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[0]); + Vector4 get wxzy => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[1]); + Vector4 get wxzz => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[2]); + Vector4 get wxzw => Vector4(_v4storage[3], _v4storage[0], _v4storage[2], _v4storage[3]); + Vector4 get wxwx => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[0]); + Vector4 get wxwy => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[1]); + Vector4 get wxwz => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[2]); + Vector4 get wxww => Vector4(_v4storage[3], _v4storage[0], _v4storage[3], _v4storage[3]); + Vector4 get wyxx => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[0]); + Vector4 get wyxy => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[1]); + Vector4 get wyxz => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[2]); + Vector4 get wyxw => Vector4(_v4storage[3], _v4storage[1], _v4storage[0], _v4storage[3]); + Vector4 get wyyx => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[0]); + Vector4 get wyyy => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[1]); + Vector4 get wyyz => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[2]); + Vector4 get wyyw => Vector4(_v4storage[3], _v4storage[1], _v4storage[1], _v4storage[3]); + Vector4 get wyzx => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[0]); + Vector4 get wyzy => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[1]); + Vector4 get wyzz => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[2]); + Vector4 get wyzw => Vector4(_v4storage[3], _v4storage[1], _v4storage[2], _v4storage[3]); + Vector4 get wywx => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[0]); + Vector4 get wywy => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[1]); + Vector4 get wywz => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[2]); + Vector4 get wyww => Vector4(_v4storage[3], _v4storage[1], _v4storage[3], _v4storage[3]); + Vector4 get wzxx => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[0]); + Vector4 get wzxy => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[1]); + Vector4 get wzxz => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[2]); + Vector4 get wzxw => Vector4(_v4storage[3], _v4storage[2], _v4storage[0], _v4storage[3]); + Vector4 get wzyx => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[0]); + Vector4 get wzyy => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[1]); + Vector4 get wzyz => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[2]); + Vector4 get wzyw => Vector4(_v4storage[3], _v4storage[2], _v4storage[1], _v4storage[3]); + Vector4 get wzzx => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[0]); + Vector4 get wzzy => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[1]); + Vector4 get wzzz => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[2]); + Vector4 get wzzw => Vector4(_v4storage[3], _v4storage[2], _v4storage[2], _v4storage[3]); + Vector4 get wzwx => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[0]); + Vector4 get wzwy => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[1]); + Vector4 get wzwz => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[2]); + Vector4 get wzww => Vector4(_v4storage[3], _v4storage[2], _v4storage[3], _v4storage[3]); + Vector4 get wwxx => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[0]); + Vector4 get wwxy => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[1]); + Vector4 get wwxz => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[2]); + Vector4 get wwxw => Vector4(_v4storage[3], _v4storage[3], _v4storage[0], _v4storage[3]); + Vector4 get wwyx => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[0]); + Vector4 get wwyy => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[1]); + Vector4 get wwyz => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[2]); + Vector4 get wwyw => Vector4(_v4storage[3], _v4storage[3], _v4storage[1], _v4storage[3]); + Vector4 get wwzx => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[0]); + Vector4 get wwzy => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[1]); + Vector4 get wwzz => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[2]); + Vector4 get wwzw => Vector4(_v4storage[3], _v4storage[3], _v4storage[2], _v4storage[3]); + Vector4 get wwwx => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[0]); + Vector4 get wwwy => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[1]); + Vector4 get wwwz => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[2]); + Vector4 get wwww => Vector4(_v4storage[3], _v4storage[3], _v4storage[3], _v4storage[3]); double get r => x; double get g => y; double get b => z; diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart index c2f1fe6..688d24b 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/barycentric_filter.dart @@ -10,9 +10,7 @@ part of '../../../vector_math_geometry.dart'; class BarycentricFilter extends GeometryFilter { @override - List get generates => [ - VertexAttrib('BARYCENTRIC', 3, 'float'), - ]; + List get generates => [VertexAttrib('BARYCENTRIC', 3, 'float')]; @override MeshGeometry filter(MeshGeometry mesh) { diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart index 1de0da4..c72363c 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/color_filter.dart @@ -13,18 +13,13 @@ class ColorFilter extends GeometryFilter { Vector4 color; @override - List get generates => [ - VertexAttrib('COLOR', 4, 'float'), - ]; + List get generates => [VertexAttrib('COLOR', 4, 'float')]; @override MeshGeometry filter(MeshGeometry mesh) { MeshGeometry output; if (mesh.getAttrib('COLOR') == null) { - final attributes = [ - ...mesh.attribs, - VertexAttrib('COLOR', 4, 'float'), - ]; + final attributes = [...mesh.attribs, VertexAttrib('COLOR', 4, 'float')]; output = MeshGeometry.resetAttribs(mesh, attributes); } else { output = MeshGeometry.copy(mesh); diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart index c21478b..5c7b5da 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/flat_shade_filter.dart @@ -10,14 +10,10 @@ part of '../../../vector_math_geometry.dart'; class FlatShadeFilter extends GeometryFilter { @override - List get requires => [ - VertexAttrib('POSITION', 3, 'float'), - ]; + List get requires => [VertexAttrib('POSITION', 3, 'float')]; @override - List get generates => [ - VertexAttrib('NORMAL', 3, 'float'), - ]; + List get generates => [VertexAttrib('NORMAL', 3, 'float')]; @override MeshGeometry filter(MeshGeometry mesh) { @@ -32,14 +28,10 @@ class FlatShadeFilter extends GeometryFilter { final p0 = Vector3.zero(), p1 = Vector3.zero(), p2 = Vector3.zero(); final VectorList? srcPosition = mesh.getViewForAttrib('POSITION'); - final VectorList? destPosition = output.getViewForAttrib( - 'POSITION', - ); + final VectorList? destPosition = output.getViewForAttrib('POSITION'); final VectorList? normals = output.getViewForAttrib('NORMAL'); - if (srcPosition is! Vector3List || - destPosition is! Vector3List || - normals is! Vector3List) { + if (srcPosition is! Vector3List || destPosition is! Vector3List || normals is! Vector3List) { throw UnimplementedError(); } diff --git a/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart b/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart index 5535f55..6cdeb5b 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/filters/transform_filter.dart @@ -13,9 +13,7 @@ class TransformFilter extends InplaceGeometryFilter { Matrix4 transform; @override - List get requires => [ - VertexAttrib('POSITION', 3, 'float'), - ]; + List get requires => [VertexAttrib('POSITION', 3, 'float')]; @override void filterInplace(MeshGeometry mesh) { diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/attribute_generators.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/attribute_generators.dart index c43a263..c600415 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/attribute_generators.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/attribute_generators.dart @@ -7,15 +7,8 @@ part of '../../../vector_math_geometry.dart'; /// Generate vertex normals based on a list of [positions] and [indices]. /// [normals] is assumed to be zeroed out, and much match [positions] in length. /// [indices] is assumed to represent a triangle list. -void generateNormals( - Vector3List normals, - Vector3List positions, - Uint16List indices, -) { - final p0 = Vector3.zero(), - p1 = Vector3.zero(), - p2 = Vector3.zero(), - norm = Vector3.zero(); +void generateNormals(Vector3List normals, Vector3List positions, Uint16List indices) { + final p0 = Vector3.zero(), p1 = Vector3.zero(), p2 = Vector3.zero(), norm = Vector3.zero(); // Loop through every polygon, find it's normal, and add that to the vertex // normals. @@ -80,8 +73,7 @@ void generateTangents( final tan = Vector4.zero(); - final tan0 = Vector3List(positions.length), - tan1 = Vector3List(positions.length); + final tan0 = Vector3List(positions.length), tan1 = Vector3List(positions.length); for (var i = 0; i < indices.length; i += 3) { final int i0 = indices[i], i1 = indices[i + 1], i2 = indices[i + 2]; diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/circle_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/circle_generator.dart index 11dae4a..45b4628 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/circle_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/circle_generator.dart @@ -52,11 +52,7 @@ class CircleGenerator extends GeometryGenerator { } @override - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { final v = Vector2(0.5, 0.5); texCoords[0] = v; var index = 1; diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/cube_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/cube_generator.dart index e99a602..fba52f9 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/cube_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/cube_generator.dart @@ -115,11 +115,7 @@ class CubeGenerator extends GeometryGenerator { } @override - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { // Front texCoords[0] = Vector2(1.0, 0.0); texCoords[1] = Vector2(0.0, 0.0); diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/cylinder_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/cylinder_generator.dart index 0088b6e..b1ec68f 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/cylinder_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/cylinder_generator.dart @@ -120,11 +120,7 @@ class CylinderGenerator extends GeometryGenerator { } @override - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { var i = 0; // Cylinder top @@ -142,19 +138,13 @@ class CylinderGenerator extends GeometryGenerator { // Top cap for (var 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, - ); + texCoords[i++] = Vector2(math.cos(r) * 0.5 + 0.5, math.sin(r) * 0.5 + 0.5); } // Bottom cap for (var 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, - ); + texCoords[i++] = Vector2(math.cos(r) * 0.5 + 0.5, math.sin(r) * 0.5 + 0.5); } } } diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/geometry_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/geometry_generator.dart index 397c5cb..5c4d452 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/geometry_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/geometry_generator.dart @@ -9,11 +9,7 @@ part of '../../../vector_math_geometry.dart'; class GeometryGeneratorFlags { - GeometryGeneratorFlags({ - this.texCoords = true, - this.normals = true, - this.tangents = true, - }); + GeometryGeneratorFlags({this.texCoords = true, this.normals = true, this.tangents = true}); final bool texCoords; final bool normals; final bool tangents; @@ -23,10 +19,7 @@ abstract class GeometryGenerator { int get vertexCount; int get indexCount; - MeshGeometry createGeometry({ - GeometryGeneratorFlags? flags, - List? filters, - }) { + MeshGeometry createGeometry({GeometryGeneratorFlags? flags, List? filters}) { flags ??= GeometryGeneratorFlags(); VertexAttrib positionAttrib; @@ -59,8 +52,7 @@ abstract class GeometryGenerator { attribs.add(tangentAttrib); } - var mesh = MeshGeometry(vertexCount, attribs) - ..indices = Uint16List(indexCount); + var mesh = MeshGeometry(vertexCount, attribs)..indices = Uint16List(indexCount); generateIndices(mesh.indices!); VectorList? view = mesh.getViewForAttrib('POSITION'); @@ -116,11 +108,7 @@ abstract class GeometryGenerator { void generateVertexPositions(Vector3List positions, Uint16List indices); - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { for (var i = 0; i < positions.length; ++i) { final Vector3 p = positions[i]; @@ -130,11 +118,7 @@ abstract class GeometryGenerator { } } - void generateVertexNormals( - Vector3List normals, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexNormals(Vector3List normals, Vector3List positions, Uint16List indices) { generateNormals(normals, positions, indices); } diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/ring_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/ring_generator.dart index 6211e3d..a8892ac 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/ring_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/ring_generator.dart @@ -62,11 +62,7 @@ class RingGenerator extends GeometryGenerator { } @override - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { if (_stripTextureCoordinates) { final v = Vector2.zero(); var index = 0; diff --git a/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart b/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart index 3f3bc01..b4be328 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/generators/sphere_generator.dart @@ -73,11 +73,7 @@ class SphereGenerator extends GeometryGenerator { } @override - void generateVertexTexCoords( - Vector2List texCoords, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexTexCoords(Vector2List texCoords, Vector3List positions, Uint16List indices) { var i = 0; for (var y = 0; y <= _latSegments; ++y) { final double v = y / _latSegments; @@ -90,11 +86,7 @@ class SphereGenerator extends GeometryGenerator { } @override - void generateVertexNormals( - Vector3List normals, - Vector3List positions, - Uint16List indices, - ) { + void generateVertexNormals(Vector3List normals, Vector3List positions, Uint16List indices) { var i = 0; for (var y = 0; y <= _latSegments; ++y) { final double v = y / _latSegments; diff --git a/packages/vector_math/lib/src/vector_math_geometry/mesh_geometry.dart b/packages/vector_math/lib/src/vector_math_geometry/mesh_geometry.dart index ee9245d..9cf54b2 100644 --- a/packages/vector_math/lib/src/vector_math_geometry/mesh_geometry.dart +++ b/packages/vector_math/lib/src/vector_math_geometry/mesh_geometry.dart @@ -18,13 +18,7 @@ class VertexAttrib { stride = attrib.stride, offset = attrib.offset; - VertexAttrib._internal( - this.name, - this.size, - this.type, - this.stride, - this.offset, - ); + VertexAttrib._internal(this.name, this.size, this.type, this.stride, this.offset); VertexAttrib._resetStrideOffset(VertexAttrib attrib, this.stride, this.offset) : name = attrib.name, @@ -93,15 +87,8 @@ class MeshGeometry { return MeshGeometry._internal(length, stride, attribs); } - MeshGeometry._internal( - this.length, - this.stride, - this.attribs, [ - Float32List? externBuffer, - ]) { - buffer = - externBuffer ?? - Float32List((length * stride) ~/ Float32List.bytesPerElement); + MeshGeometry._internal(this.length, this.stride, this.attribs, [Float32List? externBuffer]) { + buffer = externBuffer ?? Float32List((length * stride) ~/ Float32List.bytesPerElement); } MeshGeometry.copy(MeshGeometry mesh) @@ -124,11 +111,7 @@ class MeshGeometry { if (jsonBuffer is List) { buffer = Float32List.fromList(jsonBuffer); } else { - throw ArgumentError.value( - jsonBuffer, - 'json["buffer"]', - 'Value type must be List', - ); + throw ArgumentError.value(jsonBuffer, 'json["buffer"]', 'Value type must be List'); } final Object? jsonAttribs = json['attribs']; @@ -156,12 +139,7 @@ class MeshGeometry { } } - final mesh = MeshGeometry._internal( - buffer.lengthInBytes ~/ stride, - stride, - attribs, - buffer, - ); + final mesh = MeshGeometry._internal(buffer.lengthInBytes ~/ stride, stride, attribs, buffer); final Object? jsonIndices = json['indices']; if (jsonIndices is List) { @@ -171,27 +149,18 @@ class MeshGeometry { return mesh; } - factory MeshGeometry.resetAttribs( - MeshGeometry inputMesh, - List attributes, - ) { - final mesh = MeshGeometry(inputMesh.length, attributes) - ..indices = inputMesh.indices; + factory MeshGeometry.resetAttribs(MeshGeometry inputMesh, List attributes) { + final mesh = MeshGeometry(inputMesh.length, attributes)..indices = inputMesh.indices; // Copy over the attributes that were specified for (final VertexAttrib attrib in mesh.attribs) { final VertexAttrib? inputAttrib = inputMesh.getAttrib(attrib.name); if (inputAttrib != null) { - if (inputAttrib.size != attrib.size || - inputAttrib.type != attrib.type) { - throw Exception( - 'Attributes size or type is mismatched: ${attrib.name}', - ); + if (inputAttrib.size != attrib.size || inputAttrib.type != attrib.type) { + throw Exception('Attributes size or type is mismatched: ${attrib.name}'); } - final VectorList inputView = inputAttrib.getView( - inputMesh.buffer, - ); + final VectorList inputView = inputAttrib.getView(inputMesh.buffer); // Copy [inputView] to a view from attrib attrib.getView(mesh.buffer).copy(inputView); @@ -203,33 +172,23 @@ class MeshGeometry { factory MeshGeometry.combine(List meshes) { if (meshes.length < 2) { - throw Exception( - 'Must provide at least two MeshGeometry instances to combine.', - ); + throw Exception('Must provide at least two MeshGeometry instances to combine.'); } // When combining meshes they must all have a matching set of VertexAttribs final MeshGeometry firstMesh = meshes[0]; int totalVerts = firstMesh.length; - int totalIndices = firstMesh.indices != null - ? firstMesh.indices!.length - : 0; + int totalIndices = firstMesh.indices != null ? firstMesh.indices!.length : 0; for (var i = 1; i < meshes.length; ++i) { final MeshGeometry srcMesh = meshes[i]; if (!firstMesh.attribsAreCompatible(srcMesh)) { - throw Exception( - 'All meshes must have identical attributes to combine.', - ); + throw Exception('All meshes must have identical attributes to combine.'); } totalVerts += srcMesh.length; totalIndices += srcMesh.indices != null ? srcMesh.indices!.length : 0; } - final mesh = MeshGeometry._internal( - totalVerts, - firstMesh.stride, - firstMesh.attribs, - ); + final mesh = MeshGeometry._internal(totalVerts, firstMesh.stride, firstMesh.attribs); if (totalIndices > 0) { mesh.indices = Uint16List(totalIndices); @@ -277,17 +236,8 @@ class MeshGeometry { final Object? jsonType = json['type']; final Object? jsonStride = json['stride']; final Object? jsonOffset = json['offset']; - if (jsonSize is int && - jsonType is String && - jsonStride is int && - jsonOffset is int) { - return VertexAttrib._internal( - name, - jsonSize, - jsonType, - jsonStride, - jsonOffset, - ); + if (jsonSize is int && jsonType is String && jsonStride is int && jsonOffset is int) { + return VertexAttrib._internal(name, jsonSize, jsonType, jsonStride, jsonOffset); } else { throw UnimplementedError(); } @@ -329,8 +279,7 @@ class MeshGeometry { } } - if ((indices == null && mesh.indices != null) || - (indices != null && mesh.indices == null)) { + if ((indices == null && mesh.indices != null) || (indices != null && mesh.indices == null)) { return false; } diff --git a/packages/vector_math/lib/src/vector_math_lists/scalar_list_view.dart b/packages/vector_math/lib/src/vector_math_lists/scalar_list_view.dart index ff3f1b3..6396a5c 100644 --- a/packages/vector_math/lib/src/vector_math_lists/scalar_list_view.dart +++ b/packages/vector_math/lib/src/vector_math_lists/scalar_list_view.dart @@ -36,9 +36,7 @@ class ScalarListView { ScalarListView.view(Float32List buffer, [int offset = 0, int stride = 0]) : _offset = offset, _stride = stride == 0 ? 1 : stride, - _length = - (buffer.length - math.max(0, offset - stride)) ~/ - (stride == 0 ? 1 : stride), + _length = (buffer.length - math.max(0, offset - stride)) ~/ (stride == 0 ? 1 : stride), _buffer = buffer; final int _offset; final int _stride; diff --git a/packages/vector_math/lib/src/vector_math_lists/vector2_list.dart b/packages/vector_math/lib/src/vector_math_lists/vector2_list.dart index 1189e12..bcca82d 100644 --- a/packages/vector_math/lib/src/vector_math_lists/vector2_list.dart +++ b/packages/vector_math/lib/src/vector_math_lists/vector2_list.dart @@ -8,8 +8,7 @@ part of '../../vector_math_lists.dart'; class Vector2List extends VectorList { /// Create a new vector list with [length] elements. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. - Vector2List(int length, [int offset = 0, int stride = 0]) - : super(length, 2, offset, stride); + Vector2List(int length, [int offset = 0, int stride = 0]) : super(length, 2, offset, stride); /// Create a new vector list from a list of vectors. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. diff --git a/packages/vector_math/lib/src/vector_math_lists/vector3_list.dart b/packages/vector_math/lib/src/vector_math_lists/vector3_list.dart index 3db0e7a..865c2b1 100644 --- a/packages/vector_math/lib/src/vector_math_lists/vector3_list.dart +++ b/packages/vector_math/lib/src/vector_math_lists/vector3_list.dart @@ -8,8 +8,7 @@ part of '../../vector_math_lists.dart'; class Vector3List extends VectorList { /// Create a new vector list with [length] elements. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. - Vector3List(int length, [int offset = 0, int stride = 0]) - : super(length, 3, offset, stride); + Vector3List(int length, [int offset = 0, int stride = 0]) : super(length, 3, offset, stride); /// Create a new vector list from a list of vectors. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. diff --git a/packages/vector_math/lib/src/vector_math_lists/vector4_list.dart b/packages/vector_math/lib/src/vector_math_lists/vector4_list.dart index 5772b58..91a2388 100644 --- a/packages/vector_math/lib/src/vector_math_lists/vector4_list.dart +++ b/packages/vector_math/lib/src/vector_math_lists/vector4_list.dart @@ -8,8 +8,7 @@ part of '../../vector_math_lists.dart'; class Vector4List extends VectorList { /// Create a new vector list with [length] elements. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. - Vector4List(int length, [int offset = 0, int stride = 0]) - : super(length, 4, offset, stride); + Vector4List(int length, [int offset = 0, int stride = 0]) : super(length, 4, offset, stride); /// Create a new vector list from a list of vectors. Optionally it is possible /// to specify an [offset] in the [buffer] and a [stride] between each vector. diff --git a/packages/vector_math/lib/src/vector_math_lists/vector_list.dart b/packages/vector_math/lib/src/vector_math_lists/vector_list.dart index 53dc816..a75b2b4 100644 --- a/packages/vector_math/lib/src/vector_math_lists/vector_list.dart +++ b/packages/vector_math/lib/src/vector_math_lists/vector_list.dart @@ -15,9 +15,7 @@ abstract class VectorList { _offset = offset, _stride = stride == 0 ? vectorLength : stride, _length = length, - _buffer = Float32List( - VectorList._listLength(offset, stride, vectorLength, length), - ) { + _buffer = Float32List(VectorList._listLength(offset, stride, vectorLength, length)) { if (_stride < _vectorLength) { throw ArgumentError('Stride cannot be smaller than the vector size.'); } @@ -26,18 +24,12 @@ abstract class VectorList { /// Create a new vector list from a list of vectors that have a size of /// [vectorLength]. Optionally it is possible to specify an [offset] in the /// [buffer] and a [stride] between each vector. - VectorList.fromList( - List list, - int vectorLength, [ - int offset = 0, - int stride = 0, - ]) : _vectorLength = vectorLength, - _offset = offset, - _stride = stride == 0 ? vectorLength : stride, - _length = list.length, - _buffer = Float32List( - offset + list.length * (stride == 0 ? vectorLength : stride), - ) { + VectorList.fromList(List list, int vectorLength, [int offset = 0, int stride = 0]) + : _vectorLength = vectorLength, + _offset = offset, + _stride = stride == 0 ? vectorLength : stride, + _length = list.length, + _buffer = Float32List(offset + list.length * (stride == 0 ? vectorLength : stride)) { if (_stride < _vectorLength) { throw ArgumentError('Stride cannot be smaller than the vector size.'); } @@ -49,18 +41,13 @@ abstract class VectorList { /// Create a new vector list as a view of [buffer] for vectors that have a /// size of [vectorLength]. Optionally it is possible to specify an [offset] /// in the [buffer] and a [stride] between each vector. - VectorList.view( - Float32List buffer, - int vectorLength, [ - int offset = 0, - int stride = 0, - ]) : _vectorLength = vectorLength, - _offset = offset, - _stride = stride == 0 ? vectorLength : stride, - _length = - (buffer.length - math.max(0, offset - stride)) ~/ - (stride == 0 ? vectorLength : stride), - _buffer = buffer { + VectorList.view(Float32List buffer, int vectorLength, [int offset = 0, int stride = 0]) + : _vectorLength = vectorLength, + _offset = offset, + _stride = stride == 0 ? vectorLength : stride, + _length = + (buffer.length - math.max(0, offset - stride)) ~/ (stride == 0 ? vectorLength : stride), + _buffer = buffer { if (_stride < _vectorLength) { throw ArgumentError('Stride cannot be smaller than the vector size.'); } @@ -95,12 +82,7 @@ abstract class VectorList { /// Copy a range of [count] vectors beginning at [srcOffset] from [src] into /// this list starting at [offset]. - void copy( - VectorList src, { - int srcOffset = 0, - int offset = 0, - int count = 0, - }) { + void copy(VectorList src, {int srcOffset = 0, int offset = 0, int count = 0}) { if (count == 0) { count = math.min(length - offset, src.length - srcOffset); } diff --git a/packages/vector_math/lib/src/vector_math_operations/matrix.dart b/packages/vector_math/lib/src/vector_math_operations/matrix.dart index bb16878..c58234a 100644 --- a/packages/vector_math/lib/src/vector_math_operations/matrix.dart +++ b/packages/vector_math/lib/src/vector_math_operations/matrix.dart @@ -35,24 +35,17 @@ class Matrix44Operations { final double m10 = matrix[10 + offset]; final double m11 = matrix[11 + offset]; - final double det3_201_012 = - m8 * det2_01_12 - m9 * det2_01_02 + m10 * det2_01_01; - final double det3_201_013 = - m8 * det2_01_13 - m9 * det2_01_03 + m11 * det2_01_01; - final double det3_201_023 = - m8 * det2_01_23 - m10 * det2_01_03 + m11 * det2_01_02; - final double det3_201_123 = - m9 * det2_01_23 - m10 * det2_01_13 + m11 * det2_01_12; + final double det3_201_012 = m8 * det2_01_12 - m9 * det2_01_02 + m10 * det2_01_01; + final double det3_201_013 = m8 * det2_01_13 - m9 * det2_01_03 + m11 * det2_01_01; + final double det3_201_023 = m8 * det2_01_23 - m10 * det2_01_03 + m11 * det2_01_02; + final double det3_201_123 = m9 * det2_01_23 - m10 * det2_01_13 + m11 * det2_01_12; final double m12 = matrix[12 + offset]; final double m13 = matrix[13 + offset]; final double m14 = matrix[14 + offset]; final double m15 = matrix[15 + offset]; - return -det3_201_123 * m12 + - det3_201_023 * m13 - - det3_201_013 * m14 + - det3_201_012 * m15; + return -det3_201_123 * m12 + det3_201_023 * m13 - det3_201_013 * m14 + det3_201_012 * m15; } /// Compute the determinant of the upper 3x3 of the 4x4 [matrix] starting at @@ -103,8 +96,7 @@ class Matrix44Operations { final double b09 = a21 * a32 - a22 * a31; 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; + final double det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (det == 0.0) { return det; @@ -134,8 +126,7 @@ class Matrix44Operations { /// Compute the inverse of the upper 3x3 of the 4x4 [matrix] starting /// at [offset]. - static double inverse33(Float32List matrix, int offset) => - throw UnimplementedError(); + static double inverse33(Float32List matrix, int offset) => throw UnimplementedError(); /// [out] = [a] * [b]; Starting at [outOffset], [aOffset], and [bOffset]. static void multiply( diff --git a/packages/vector_math/test/aabb3_test.dart b/packages/vector_math/test/aabb3_test.dart index fe6de6a..dce2c0f 100644 --- a/packages/vector_math/test/aabb3_test.dart +++ b/packages/vector_math/test/aabb3_test.dart @@ -11,15 +11,7 @@ import 'package:vector_math/vector_math.dart'; import 'test_utils.dart'; void testAabb3ByteBufferInstanciation() { - final ByteBuffer buffer = Float32List.fromList([ - 1.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 7.0, - ]).buffer; + final ByteBuffer buffer = Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]).buffer; final aabb = Aabb3.fromBuffer(buffer, 0); final aabbOffest = Aabb3.fromBuffer(buffer, Float32List.bytesPerElement); @@ -66,14 +58,8 @@ void testAabb3CopyCenterAndHalfExtents() { } void testAabb3setCenterAndHalfExtents() { - final a1 = Aabb3.centerAndHalfExtents( - $v3(0.0, 0.0, 0.0), - $v3(10.0, 20.0, 30.0), - ); - final a2 = Aabb3.centerAndHalfExtents( - $v3(-10.0, -20.0, -30.0), - $v3(10.0, 20.0, 30.0), - ); + final a1 = Aabb3.centerAndHalfExtents($v3(0.0, 0.0, 0.0), $v3(10.0, 20.0, 30.0)); + final a2 = Aabb3.centerAndHalfExtents($v3(-10.0, -20.0, -30.0), $v3(10.0, 20.0, 30.0)); relativeTest(a1.min, $v3(-10.0, -20.0, -30.0)); relativeTest(a1.max, $v3(10.0, 20.0, 30.0)); @@ -91,10 +77,7 @@ void testAabb3setSphere() { } void testAabb3setRay() { - final r = Ray.originDirection( - $v3(1.0, 2.0, 3.0), - $v3(1.0, 5.0, -1.0)..normalize(), - ); + final r = Ray.originDirection($v3(1.0, 2.0, 3.0), $v3(1.0, 5.0, -1.0)..normalize()); final a = Aabb3.fromRay(r, 0.0, 10.0); expect(a.intersectsWithVector3(r.at(0.0)), isTrue); @@ -102,11 +85,7 @@ void testAabb3setRay() { } void testAabb3setTriangle() { - final t = Triangle.points( - $v3(2.0, 0.0, 0.0), - $v3(0.0, 2.0, 0.0), - $v3(0.0, 0.0, 2.0), - ); + final t = Triangle.points($v3(2.0, 0.0, 0.0), $v3(0.0, 2.0, 0.0), $v3(0.0, 0.0, 2.0)); final a = Aabb3.fromTriangle(t); expect(a.intersectsWithVector3(t.point0), isTrue); @@ -167,26 +146,10 @@ void testAabb3ContainsVector3() { void testAabb3ContainsTriangle() { final parent = Aabb3.minMax($v3(1.0, 1.0, 1.0), $v3(8.0, 8.0, 8.0)); - final child = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final edge = Triangle.points( - $v3(1.0, 1.0, 1.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final cutting = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(14.0, 14.0, 14.0), - ); - final outside = Triangle.points( - $v3(0.0, 0.0, 0.0), - $v3(-3.0, -3.0, -3.0), - $v3(-4.0, -4.0, -4.0), - ); + final child = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final edge = Triangle.points($v3(1.0, 1.0, 1.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final cutting = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(14.0, 14.0, 14.0)); + final outside = Triangle.points($v3(0.0, 0.0, 0.0), $v3(-3.0, -3.0, -3.0), $v3(-4.0, -4.0, -4.0)); expect(parent.containsTriangle(child), isTrue); expect(parent.containsTriangle(edge), isFalse); @@ -244,26 +207,10 @@ void testAabb3IntersectionSphere() { void testIntersectionTriangle() { final parent = Aabb3.minMax($v3(1.0, 1.0, 1.0), $v3(8.0, 8.0, 8.0)); - final child = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final edge = Triangle.points( - $v3(1.0, 1.0, 1.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final cutting = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(14.0, 14.0, 14.0), - ); - final outside = Triangle.points( - $v3(0.0, 0.0, 0.0), - $v3(-3.0, -3.0, -3.0), - $v3(-4.0, -4.0, -4.0), - ); + final child = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final edge = Triangle.points($v3(1.0, 1.0, 1.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final cutting = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(14.0, 14.0, 14.0)); + final outside = Triangle.points($v3(0.0, 0.0, 0.0), $v3(-3.0, -3.0, -3.0), $v3(-4.0, -4.0, -4.0)); expect(parent.intersectsWithTriangle(child), isTrue); expect(parent.intersectsWithTriangle(edge), isTrue); diff --git a/packages/vector_math/test/colors_test.dart b/packages/vector_math/test/colors_test.dart index 81af22c..24c4b4d 100644 --- a/packages/vector_math/test/colors_test.dart +++ b/packages/vector_math/test/colors_test.dart @@ -122,10 +122,7 @@ void testHexString() { expect(Colors.toHexString(color, alpha: true), equals('00000000')); - expect( - () => Colors.fromHexString('vector_math rules!', color), - throwsA(isA()), - ); + expect(() => Colors.fromHexString('vector_math rules!', color), throwsA(isA())); } void testFromRgba() { diff --git a/packages/vector_math/test/frustum_test.dart b/packages/vector_math/test/frustum_test.dart index c50889a..7933d88 100644 --- a/packages/vector_math/test/frustum_test.dart +++ b/packages/vector_math/test/frustum_test.dart @@ -9,9 +9,7 @@ import 'package:vector_math/vector_math.dart'; import 'test_utils.dart'; void testFrustumContainsVector3() { - final frustum = Frustum.matrix( - makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0), - ); + final frustum = Frustum.matrix(makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0)); expect(frustum.containsVector3($v3(0.0, 0.0, 0.0)), isFalse); expect(frustum.containsVector3($v3(0.0, 0.0, -50.0)), isTrue); @@ -29,136 +27,48 @@ void testFrustumContainsVector3() { } void testFrustumIntersectsWithSphere() { - final frustum = Frustum.matrix( - makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0), - ); + final frustum = Frustum.matrix(makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0)); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 0.0)), isFalse); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 0.9)), isFalse); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 1.1)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -50.0), 0.0)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -1.001), 0.0)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(-1.0, -1.0, -1.001), 0.0)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(-1.1, -1.1, -1.001), 0.0)), isFalse); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(-1.1, -1.1, -1.001), 0.5)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(1.0, 1.0, -1.001), 0.0)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(1.1, 1.1, -1.001), 0.0)), isFalse); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(1.1, 1.1, -1.001), 0.5)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -99.999), 0.5)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -99.999), 0.0)), isTrue); expect( - frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 0.0)), - isFalse, - ); - expect( - frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 0.9)), - isFalse, - ); - expect( - frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, 0.0), 1.1)), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -50.0), 0.0), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -1.001), 0.0), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-1.0, -1.0, -1.001), 0.0), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-1.1, -1.1, -1.001), 0.0), - ), - isFalse, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-1.1, -1.1, -1.001), 0.5), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(1.0, 1.0, -1.001), 0.0), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(1.1, 1.1, -1.001), 0.0), - ), - isFalse, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(1.1, 1.1, -1.001), 0.5), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -99.999), 0.5), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -99.999), 0.0), - ), + frustum.intersectsWithSphere(Sphere.centerRadius($v3(-99.999, -99.999, -99.999), 0.0)), isTrue, ); expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-99.999, -99.999, -99.999), 0.0), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-100.1, -100.1, -100.1), 0.0), - ), + frustum.intersectsWithSphere(Sphere.centerRadius($v3(-100.1, -100.1, -100.1), 0.0)), isFalse, ); expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(-100.1, -100.1, -100.1), 0.5), - ), - isTrue, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(99.999, 99.999, -99.999), 0.0), - ), + frustum.intersectsWithSphere(Sphere.centerRadius($v3(-100.1, -100.1, -100.1), 0.5)), isTrue, ); expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(100.1, 100.1, -100.1), 0.0), - ), - isFalse, - ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(100.1, 100.1, -100.1), 0.2), - ), + frustum.intersectsWithSphere(Sphere.centerRadius($v3(99.999, 99.999, -99.999), 0.0)), isTrue, ); expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -101.0), 0.0), - ), + frustum.intersectsWithSphere(Sphere.centerRadius($v3(100.1, 100.1, -100.1), 0.0)), isFalse, ); - expect( - frustum.intersectsWithSphere( - Sphere.centerRadius($v3(0.0, 0.0, -101.0), 1.1), - ), - isTrue, - ); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(100.1, 100.1, -100.1), 0.2)), isTrue); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -101.0), 0.0)), isFalse); + expect(frustum.intersectsWithSphere(Sphere.centerRadius($v3(0.0, 0.0, -101.0), 1.1)), isTrue); } void testFrustumIntersectsWithAabb3() { - final frustum = Frustum.matrix( - makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0), - ); + final frustum = Frustum.matrix(makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0)); expect( frustum.intersectsWithAabb3( @@ -173,53 +83,37 @@ void testFrustumIntersectsWithAabb3() { isTrue, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(-1.5, -1.5, -1.5), $v3(1.5, 1.5, 1.5)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(-1.5, -1.5, -1.5), $v3(1.5, 1.5, 1.5))), isTrue, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(0.0, 0.0, -50.0), $v3(1.0, 1.0, -49.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(0.0, 0.0, -50.0), $v3(1.0, 1.0, -49.0))), isTrue, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(0.0, 0.0, 50.0), $v3(1.0, 1.0, 51.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(0.0, 0.0, 50.0), $v3(1.0, 1.0, 51.0))), isFalse, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(0.0, 0.0, -0.99), $v3(1.0, 1.0, 1.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(0.0, 0.0, -0.99), $v3(1.0, 1.0, 1.0))), isFalse, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(0.0, 0.0, -1.0), $v3(1.0, 1.0, 1.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(0.0, 0.0, -1.0), $v3(1.0, 1.0, 1.0))), isTrue, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(0.0, 1.0, -10.0), $v3(1.0, 2.0, 15.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(0.0, 1.0, -10.0), $v3(1.0, 2.0, 15.0))), isTrue, ); expect( - frustum.intersectsWithAabb3( - Aabb3.minMax($v3(1.1, 1.1, -1.0), $v3(2.0, 2.0, 0.0)), - ), + frustum.intersectsWithAabb3(Aabb3.minMax($v3(1.1, 1.1, -1.0), $v3(2.0, 2.0, 0.0))), isFalse, ); } void testFrustumCalculateCorners() { - final frustum = Frustum.matrix( - makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0), - ); + final frustum = Frustum.matrix(makeFrustumMatrix(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0)); final c0 = Vector3.zero(); final c1 = Vector3.zero(); diff --git a/packages/vector_math/test/geometry_test.dart b/packages/vector_math/test/geometry_test.dart index aa63244..32fabb5 100644 --- a/packages/vector_math/test/geometry_test.dart +++ b/packages/vector_math/test/geometry_test.dart @@ -123,16 +123,8 @@ void testCombineIndices() { // Combining two meshes should generate indices that are not out of range. final sphereGenerator = SphereGenerator(); - final MeshGeometry sphere0 = sphereGenerator.createSphere( - 10.0, - latSegments: 8, - lonSegments: 8, - ); - final MeshGeometry sphere1 = sphereGenerator.createSphere( - 10.0, - latSegments: 8, - lonSegments: 8, - ); + final MeshGeometry sphere0 = sphereGenerator.createSphere(10.0, latSegments: 8, lonSegments: 8); + final MeshGeometry sphere1 = sphereGenerator.createSphere(10.0, latSegments: 8, lonSegments: 8); final combined = MeshGeometry.combine([sphere0, sphere1]); expect(combined.indices, everyElement(lessThan(combined.length))); diff --git a/packages/vector_math/test/matrix3_test.dart b/packages/vector_math/test/matrix3_test.dart index 8cb3cb4..30cfcab 100644 --- a/packages/vector_math/test/matrix3_test.dart +++ b/packages/vector_math/test/matrix3_test.dart @@ -247,14 +247,8 @@ void testMatrix3Transform() { final input = Vector3(1.0, 0.0, 0.0); relativeTest(rotX.transformed(input), input); - relativeTest( - rotY.transformed(input), - Vector3(1.0 / math.sqrt(2.0), 0.0, -1.0 / math.sqrt(2.0)), - ); - relativeTest( - rotZ.transformed(input), - Vector3(1.0 / math.sqrt(2.0), 1.0 / math.sqrt(2.0), 0.0), - ); + relativeTest(rotY.transformed(input), Vector3(1.0 / math.sqrt(2.0), 0.0, -1.0 / math.sqrt(2.0))); + relativeTest(rotZ.transformed(input), Vector3(1.0 / math.sqrt(2.0), 1.0 / math.sqrt(2.0), 0.0)); } void testMatrix3RotationX() { @@ -281,25 +275,12 @@ void testMatrix3RotationZ() { void testMatrix3Transform2() { final rotZ = Matrix3.rotationZ(math.pi / 4); final trans = Matrix3(1.0, 0.0, 3.0, 0.0, 1.0, 2.0, 3.0, 2.0, 1.0); - final transB = Matrix3.fromList([ - 1.0, - 0.0, - 3.0, - 0.0, - 1.0, - 2.0, - 3.0, - 2.0, - 1.0, - ]); + final transB = Matrix3.fromList([1.0, 0.0, 3.0, 0.0, 1.0, 2.0, 3.0, 2.0, 1.0]); expect(trans, equals(transB)); final input = Vector2(1.0, 0.0); - relativeTest( - rotZ.transform2(input.clone()), - Vector2(math.sqrt(0.5), math.sqrt(0.5)), - ); + relativeTest(rotZ.transform2(input.clone()), Vector2(math.sqrt(0.5), math.sqrt(0.5))); relativeTest(trans.transform2(input.clone()), Vector2(4.0, 2.0)); } @@ -313,15 +294,9 @@ void testMatrix3AbsoluteRotate2() { final input = Vector2(1.0, 0.0); - relativeTest( - rotZ.absoluteRotate2(input.clone()), - Vector2(math.sqrt(0.5), math.sqrt(0.5)), - ); + relativeTest(rotZ.absoluteRotate2(input.clone()), Vector2(math.sqrt(0.5), math.sqrt(0.5))); - relativeTest( - rotZcw.absoluteRotate2(input.clone()), - Vector2(math.sqrt(0.5), math.sqrt(0.5)), - ); + relativeTest(rotZcw.absoluteRotate2(input.clone()), Vector2(math.sqrt(0.5), math.sqrt(0.5))); } void testMatrix3ConstructorCopy() { diff --git a/packages/vector_math/test/matrix4_test.dart b/packages/vector_math/test/matrix4_test.dart index ab200ff..33f31b2 100644 --- a/packages/vector_math/test/matrix4_test.dart +++ b/packages/vector_math/test/matrix4_test.dart @@ -117,13 +117,11 @@ void testMatrix4Transpose() { final inputA = []; final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466 0.900053846417662 0.389738836961253 0.131973292606335 0.059779542947156 0.369246781120215 0.241691285913833 0.942050590775485 0.234779913372406 - 0.111202755293787 0.403912145588115 0.956134540229802 0.353158571222071''', - ), + 0.111202755293787 0.403912145588115 0.956134540229802 0.353158571222071'''), ); expectedOutput.add(inputA[0].transposed()); @@ -139,13 +137,11 @@ void testMatrix4VectorMultiplication() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.337719409821377 0.780252068321138 0.096454525168389 0.575208595078466 0.900053846417662 0.389738836961253 0.131973292606335 0.059779542947156 0.369246781120215 0.241691285913833 0.942050590775485 0.234779913372406 - 0.111202755293787 0.403912145588115 0.956134540229802 0.353158571222071''', - ), + 0.111202755293787 0.403912145588115 0.956134540229802 0.353158571222071'''), ); inputB.add( parseVector(''' @@ -177,31 +173,25 @@ void testMatrix4Multiplication() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.587044704531417 0.230488160211558 0.170708047147859 0.923379642103244 0.207742292733028 0.844308792695389 0.227664297816554 0.430207391329584 0.301246330279491 0.194764289567049 0.435698684103899 0.184816320124136 - 0.470923348517591 0.225921780972399 0.311102286650413 0.904880968679893''', - ), + 0.470923348517591 0.225921780972399 0.311102286650413 0.904880968679893'''), ); inputB.add( - parseMatrix( - ''' + parseMatrix(''' 0.979748378356085 0.408719846112552 0.711215780433683 0.318778301925882 0.438869973126103 0.594896074008614 0.221746734017240 0.424166759713807 0.111119223440599 0.262211747780845 0.117417650855806 0.507858284661118 - 0.258064695912067 0.602843089382083 0.296675873218327 0.085515797090044''', - ), + 0.258064695912067 0.602843089382083 0.296675873218327 0.085515797090044'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 0.933571062150012 0.978468014433530 0.762614053950618 0.450561572247979 0.710396171182635 0.906228190244263 0.489336274658484 0.576762187862375 0.476730868989407 0.464650419830879 0.363428748133464 0.415721232510293 - 0.828623949506267 0.953951612073692 0.690010785130483 0.481326146122225''', - ), + 0.828623949506267 0.953951612073692 0.690010785130483 0.481326146122225'''), ); assert(inputA.length == inputB.length); @@ -218,22 +208,18 @@ void testMatrix4Adjoint() { final expectedOutput = []; input.add( - parseMatrix( - ''' + parseMatrix(''' 0.934010684229183 0.011902069501241 0.311215042044805 0.262971284540144 0.129906208473730 0.337122644398882 0.528533135506213 0.654079098476782 0.568823660872193 0.162182308193243 0.165648729499781 0.689214503140008 - 0.469390641058206 0.794284540683907 0.601981941401637 0.748151592823709''', - ), + 0.469390641058206 0.794284540683907 0.601981941401637 0.748151592823709'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 0.104914550911225 -0.120218628213523 0.026180662741638 0.044107217835411 -0.081375770192194 -0.233925009984709 -0.022194776259965 0.253560794325371 0.155967414263983 0.300399085119975 -0.261648453454468 -0.076412061081351 - -0.104925204524921 0.082065846290507 0.217666653572481 -0.077704028180558''', - ), + -0.104925204524921 0.082065846290507 0.217666653572481 -0.077704028180558'''), ); input.add( parseMatrix(''' @@ -251,22 +237,18 @@ void testMatrix4Adjoint() { ); input.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' -0.100386867815513 0.076681891597503 -0.049082198794982 -0.021689260610181 -0.279454715225440 -0.269081505356250 0.114433412778961 0.133858687769130 0.218879650360982 0.073892735462981 0.069073300555062 -0.132069899391626 - 0.183633794399577 0.146113141160308 -0.156100829983306 -0.064859465665816''', - ), + 0.183633794399577 0.146113141160308 -0.156100829983306 -0.064859465665816'''), ); assert(input.length == expectedOutput.length); @@ -282,35 +264,29 @@ void testMatrix4Determinant() { final input = []; final expectedOutput = []; input.add( - parseMatrix( - ''' + parseMatrix(''' 0.046171390631154 0.317099480060861 0.381558457093008 0.489764395788231 0.097131781235848 0.950222048838355 0.765516788149002 0.445586200710899 0.823457828327293 0.034446080502909 0.795199901137063 0.646313010111265 - 0.694828622975817 0.438744359656398 0.186872604554379 0.709364830858073''', - ), + 0.694828622975817 0.438744359656398 0.186872604554379 0.709364830858073'''), ); expectedOutput.add(-0.199908980087990); input.add( - parseMatrix( - ''' + parseMatrix(''' -2.336158020850647 0.358791716162913 0.571930324052307 0.866477090273158 -1.190335868711951 1.132044609886021 -0.693048859451418 0.742195189800671 0.015919048685702 0.552417702663606 1.020805610524362 -1.288062497216858 - 3.020318574990609 -1.197139524685751 -0.400475005629390 0.441263145991252''', - ), + 3.020318574990609 -1.197139524685751 -0.400475005629390 0.441263145991252'''), ); expectedOutput.add(-5.002276533849802); input.add( - parseMatrix( - ''' + parseMatrix(''' 0.934010684229183 0.011902069501241 0.311215042044805 0.262971284540144 0.129906208473730 0.337122644398882 0.528533135506213 0.654079098476782 0.568823660872193 0.162182308193243 0.165648729499781 0.689214503140008 - 0.469390641058206 0.794284540683907 0.601981941401637 0.748151592823709''', - ), + 0.469390641058206 0.794284540683907 0.601981941401637 0.748151592823709'''), ); expectedOutput.add(0.117969860982876); assert(input.length == expectedOutput.length); @@ -328,31 +304,25 @@ void testMatrix4SelfTransposeMultiply() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); inputB.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 1.096629343508065 1.170948826011164 0.975285713492989 1.047596917860438 1.170948826011164 1.987289692246011 1.393079247172284 1.945966332001094 0.975285713492989 1.393079247172284 1.138698195167051 1.266161729169725 - 1.047596917860438 1.945966332001094 1.266161729169725 2.023122749969790''', - ), + 1.047596917860438 1.945966332001094 1.266161729169725 2.023122749969790'''), ); assert(inputA.length == inputB.length); @@ -371,31 +341,25 @@ void testMatrix4SelfMultiply() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); inputB.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 0.237893273152584 0.241190507375353 0.115471053480014 0.188086069635435 0.916103942227480 1.704973929800637 1.164721763902784 1.675285658272358 0.919182849383279 1.351023203753565 1.053750106199745 1.215382950294249 - 1.508657696357159 2.344965008135463 1.450552688877760 2.316940716769603''', - ), + 1.508657696357159 2.344965008135463 1.450552688877760 2.316940716769603'''), ); assert(inputA.length == inputB.length); @@ -414,31 +378,25 @@ void testMatrix4LeftMultiply() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); inputB.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 0.237893273152584 0.241190507375353 0.115471053480014 0.188086069635435 0.916103942227480 1.704973929800637 1.164721763902784 1.675285658272358 0.919182849383279 1.351023203753565 1.053750106199745 1.215382950294249 - 1.508657696357159 2.344965008135463 1.450552688877760 2.316940716769603''', - ), + 1.508657696357159 2.344965008135463 1.450552688877760 2.316940716769603'''), ); assert(inputA.length == inputB.length); @@ -457,31 +415,25 @@ void testMatrix4SelfMultiplyTranspose() { final expectedOutput = []; inputA.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); inputB.add( - parseMatrix( - ''' + parseMatrix(''' 0.450541598502498 0.152378018969223 0.078175528753184 0.004634224134067 0.083821377996933 0.825816977489547 0.442678269775446 0.774910464711502 0.228976968716819 0.538342435260057 0.106652770180584 0.817303220653433 - 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510''', - ), + 0.913337361501670 0.996134716626885 0.961898080855054 0.868694705363510'''), ); expectedOutput.add( - parseMatrix( - ''' + parseMatrix(''' 0.232339681975335 0.201799089276976 0.197320406329789 0.642508126615338 0.201799089276976 1.485449982570056 1.144315170085286 1.998154153033270 0.197320406329789 1.144315170085286 1.021602397682138 1.557970885061235 - 0.642508126615338 1.998154153033270 1.557970885061235 3.506347918663387''', - ), + 0.642508126615338 1.998154153033270 1.557970885061235 3.506347918663387'''), ); assert(inputA.length == inputB.length); @@ -531,20 +483,14 @@ void testMatrix4Translation() { output3[14] = input.dotRow(2, Vector4(4, 8, 12, 1)); output3[15] = input.dotRow(3, Vector4(4, 8, 12, 1)); relativeTest(input.clone()..translateByDouble(4.0, 8.0, 12.0, 1.0), output3); - relativeTest( - input.clone()..translateByVector3(Vector3(4.0, 8.0, 12.0)), - output3, - ); + relativeTest(input.clone()..translateByVector3(Vector3(4.0, 8.0, 12.0)), output3); final Matrix4 output4 = input.clone(); output4[12] = input.dotRow(0, Vector4(4, 8, 12, 16)); output4[13] = input.dotRow(1, Vector4(4, 8, 12, 16)); output4[14] = input.dotRow(2, Vector4(4, 8, 12, 16)); output4[15] = input.dotRow(3, Vector4(4, 8, 12, 16)); - relativeTest( - input.clone()..translateByVector4(Vector4(4, 8, 12, 16)), - output4, - ); + relativeTest(input.clone()..translateByVector4(Vector4(4, 8, 12, 16)), output4); } void testMatrix4Scale() { @@ -621,24 +567,7 @@ void testMatrix4Column() { } void testMatrix4Inversion() { - final m = Matrix4( - 1.0, - 0.0, - 2.0, - 2.0, - 0.0, - 2.0, - 1.0, - 0.0, - 0.0, - 1.0, - 0.0, - 1.0, - 1.0, - 2.0, - 1.0, - 4.0, - ); + final m = Matrix4(1.0, 0.0, 2.0, 2.0, 0.0, 2.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 2.0, 1.0, 4.0); final result = Matrix4.zero(); final double det = result.copyInverse(m); expect(det, 2.0); @@ -778,18 +707,8 @@ void testMatrix4Compose() { final rValues = [ Quaternion.identity(), - Quaternion( - 0.42073549240394825, - 0.42073549240394825, - 0.22984884706593015, - 0.7701511529340699, - ), - Quaternion( - 0.16751879124639693, - -0.5709414713577319, - 0.16751879124639693, - 0.7860666291368439, - ), + Quaternion(0.42073549240394825, 0.42073549240394825, 0.22984884706593015, 0.7701511529340699), + Quaternion(0.16751879124639693, -0.5709414713577319, 0.16751879124639693, 0.7860666291368439), Quaternion(0.0, 0.9238795292366128, 0.0, 0.38268342717215614), ]; diff --git a/packages/vector_math/test/obb3_test.dart b/packages/vector_math/test/obb3_test.dart index 69ed186..093f474 100644 --- a/packages/vector_math/test/obb3_test.dart +++ b/packages/vector_math/test/obb3_test.dart @@ -328,41 +328,13 @@ void testIntersectionTriangle() { final parent = Obb3(); parent.center.setValues(4.5, 4.5, 4.5); parent.halfExtents.setValues(3.5, 3.5, 3.5); - final child = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final edge = Triangle.points( - $v3(1.0, 1.0, 1.0), - $v3(3.0, 3.0, 3.0), - $v3(4.0, 4.0, 4.0), - ); - final cutting = Triangle.points( - $v3(2.0, 2.0, 2.0), - $v3(3.0, 3.0, 3.0), - $v3(14.0, 14.0, 14.0), - ); - final outside = Triangle.points( - $v3(0.0, 0.0, 0.0), - $v3(-3.0, -3.0, -3.0), - $v3(-4.0, -4.0, -4.0), - ); - final parallel0 = Triangle.points( - $v3(1.0, 0.0, 1.0), - $v3(1.0, 10.0, 1.0), - $v3(1.0, 0.0, 10.0), - ); - final parallel1 = Triangle.points( - $v3(1.0, 4.5, 0.0), - $v3(1.0, -1.0, 9.0), - $v3(1.0, 10.0, 9.0), - ); - final parallel2 = Triangle.points( - $v3(1.0, 10.0, 9.0), - $v3(1.0, -1.0, 9.0), - $v3(1.0, 4.5, 0.0), - ); + final child = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final edge = Triangle.points($v3(1.0, 1.0, 1.0), $v3(3.0, 3.0, 3.0), $v3(4.0, 4.0, 4.0)); + final cutting = Triangle.points($v3(2.0, 2.0, 2.0), $v3(3.0, 3.0, 3.0), $v3(14.0, 14.0, 14.0)); + final outside = Triangle.points($v3(0.0, 0.0, 0.0), $v3(-3.0, -3.0, -3.0), $v3(-4.0, -4.0, -4.0)); + final parallel0 = Triangle.points($v3(1.0, 0.0, 1.0), $v3(1.0, 10.0, 1.0), $v3(1.0, 0.0, 10.0)); + final parallel1 = Triangle.points($v3(1.0, 4.5, 0.0), $v3(1.0, -1.0, 9.0), $v3(1.0, 10.0, 9.0)); + final parallel2 = Triangle.points($v3(1.0, 10.0, 9.0), $v3(1.0, -1.0, 9.0), $v3(1.0, 4.5, 0.0)); expect(parent.intersectsWithTriangle(child), isTrue); expect(parent.intersectsWithTriangle(edge), isTrue); diff --git a/packages/vector_math/test/opengl_matrix_test.dart b/packages/vector_math/test/opengl_matrix_test.dart index bafbd09..a9fb475 100644 --- a/packages/vector_math/test/opengl_matrix_test.dart +++ b/packages/vector_math/test/opengl_matrix_test.dart @@ -31,11 +31,7 @@ void testLookAt() { final lookAtPosition = Vector3(0.0, 0.0, -1.0); final upDirection = Vector3(0.0, 1.0, 0.0); - final Matrix4 lookat = makeViewMatrix( - eyePosition, - lookAtPosition, - upDirection, - ); + final Matrix4 lookat = makeViewMatrix(eyePosition, lookAtPosition, upDirection); assert(lookat.getColumn(0).w == 0.0); assert(lookat.getColumn(1).w == 0.0); assert(lookat.getColumn(2).w == 0.0); @@ -60,10 +56,7 @@ void testFrustumMatrix() { frustum.getColumn(2), Vector4((r + l) / (r - l), (t + b) / (t - b), -(f + n) / (f - n), -1.0), ); - relativeTest( - frustum.getColumn(3), - Vector4(0.0, 0.0, -2.0 * f * n / (f - n), 0.0), - ); + relativeTest(frustum.getColumn(3), Vector4(0.0, 0.0, -2.0 * f * n / (f - n), 0.0)); } void testPerspectiveMatrix() { @@ -72,18 +65,10 @@ void testPerspectiveMatrix() { const zNear = 1.0; const zFar = 100.0; - final Matrix4 perspective = makePerspectiveMatrix( - fov, - aspectRatio, - zNear, - zFar, - ); + final Matrix4 perspective = makePerspectiveMatrix(fov, aspectRatio, zNear, zFar); relativeTest(perspective.getColumn(0), Vector4(0.5, 0.0, 0.0, 0.0)); relativeTest(perspective.getColumn(1), Vector4(0.0, 1.0, 0.0, 0.0)); - relativeTest( - perspective.getColumn(2), - Vector4(0.0, 0.0, -101.0 / 99.0, -1.0), - ); + relativeTest(perspective.getColumn(2), Vector4(0.0, 0.0, -101.0 / 99.0, -1.0)); relativeTest(perspective.getColumn(3), Vector4(0.0, 0.0, -200.0 / 99.0, 0.0)); } diff --git a/packages/vector_math/test/quad_test.dart b/packages/vector_math/test/quad_test.dart index 4f366ba..4abe646 100644 --- a/packages/vector_math/test/quad_test.dart +++ b/packages/vector_math/test/quad_test.dart @@ -74,10 +74,7 @@ void testQuadEquals() { expect(quad, isNot(Quad.points(v1, v2, Vector3.zero(), v4))); expect(quad, isNot(Quad.points(v1, v2, v3, Vector3.zero()))); - expect( - Quad.points(v1, v2, v3, v4).hashCode, - equals(Quad.points(v1, v2, v3, v4).hashCode), - ); + expect(Quad.points(v1, v2, v3, v4).hashCode, equals(Quad.points(v1, v2, v3, v4).hashCode)); } void main() { diff --git a/packages/vector_math/test/quaternion_test.dart b/packages/vector_math/test/quaternion_test.dart index e086d5e..d3d1440 100644 --- a/packages/vector_math/test/quaternion_test.dart +++ b/packages/vector_math/test/quaternion_test.dart @@ -25,10 +25,7 @@ void testQuaternionInstacingFromByteBuffer() { final float32List = Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0]); final ByteBuffer buffer = float32List.buffer; final zeroOffset = Quaternion.fromBuffer(buffer, 0); - final offsetVector = Quaternion.fromBuffer( - buffer, - Float32List.bytesPerElement, - ); + final offsetVector = Quaternion.fromBuffer(buffer, Float32List.bytesPerElement); expect(zeroOffset.x, equals(1.0)); expect(zeroOffset.y, equals(2.0)); @@ -83,10 +80,7 @@ void testQuaternionVectorRotate( List inputB, List expectedOutput, ) { - assert( - (inputA.length == inputB.length) && - (inputB.length == expectedOutput.length), - ); + assert((inputA.length == inputB.length) && (inputB.length == expectedOutput.length)); for (var i = 0; i < inputA.length; i++) { final Vector3 output = inputA[i].rotate(inputB[i]); relativeTest(output, expectedOutput[i]); @@ -246,20 +240,11 @@ void testFromTwoVectors() { } void testSmallAngleQuaternionAxis() { - final quaternion32 = Quaternion.axisAngle( - Vector3(0.0, 0.0, 1.0), - 0.6 * degrees2Radians, - ); + final quaternion32 = Quaternion.axisAngle(Vector3(0.0, 0.0, 1.0), 0.6 * degrees2Radians); relativeTest(quaternion32.axis, Vector3(0.0, 0.0, 1.0)); relativeTest(quaternion32.radians, 0.6 * degrees2Radians); - final quaternion64 = v64.Quaternion.axisAngle( - v64.Vector3(0, 0, 1), - 0.01 * degrees2Radians, - ); - expect( - quaternion64.axis.relativeError(v64.Vector3(0, 0, 1)), - closeTo(0, 1e-5), - ); + final quaternion64 = v64.Quaternion.axisAngle(v64.Vector3(0, 0, 1), 0.01 * degrees2Radians); + expect(quaternion64.axis.relativeError(v64.Vector3(0, 0, 1)), closeTo(0, 1e-5)); expect(quaternion64.radians, closeTo(0.01 * degrees2Radians, 1e-5)); } @@ -269,10 +254,7 @@ void main() { test('ByteBuffer instacing', testQuaternionInstacingFromByteBuffer); test('Negate', testQuaternionNegate); test('Conjugate', testQuaternionConjugate); - test( - 'Matrix Quaternion Round Trip', - testQuaternionMatrixQuaternionRoundTrip, - ); + test('Matrix Quaternion Round Trip', testQuaternionMatrixQuaternionRoundTrip); test('Multiply', testQuaternionMultiplying); test('Normalize', testQuaternionNormalize); test('Axis-Angle', testQuaternionAxisAngle); diff --git a/packages/vector_math/test/ray_test.dart b/packages/vector_math/test/ray_test.dart index 3ba419d..f84ff63 100644 --- a/packages/vector_math/test/ray_test.dart +++ b/packages/vector_math/test/ray_test.dart @@ -63,26 +63,10 @@ void testRayIntersectionSphere() { void testRayIntersectionTriangle() { final parent = Ray.originDirection($v3(1.0, 1.0, 1.0), $v3(0.0, 1.0, 0.0)); - final hitting = Triangle.points( - $v3(2.0, 2.0, 0.0), - $v3(0.0, 4.0, -1.0), - $v3(0.0, 4.0, 3.0), - ); - final cutting = Triangle.points( - $v3(0.0, 1.5, 1.0), - $v3(2.0, 1.5, 1.0), - $v3(1.0, 1.5, 3.0), - ); - final outside = Triangle.points( - $v3(2.0, 2.0, 0.0), - $v3(2.0, 6.0, 0.0), - $v3(2.0, 2.0, 3.0), - ); - final behind = Triangle.points( - $v3(0.0, 0.0, 0.0), - $v3(0.0, 3.0, 0.0), - $v3(0.0, 3.0, 4.0), - ); + final hitting = Triangle.points($v3(2.0, 2.0, 0.0), $v3(0.0, 4.0, -1.0), $v3(0.0, 4.0, 3.0)); + final cutting = Triangle.points($v3(0.0, 1.5, 1.0), $v3(2.0, 1.5, 1.0), $v3(1.0, 1.5, 3.0)); + final outside = Triangle.points($v3(2.0, 2.0, 0.0), $v3(2.0, 6.0, 0.0), $v3(2.0, 2.0, 3.0)); + final behind = Triangle.points($v3(0.0, 0.0, 0.0), $v3(0.0, 3.0, 0.0), $v3(0.0, 3.0, 4.0)); absoluteTest(parent.intersectsWithTriangle(hitting), 2.0); absoluteTest(parent.intersectsWithTriangle(cutting), 0.5); diff --git a/packages/vector_math/test/test_utils.dart b/packages/vector_math/test/test_utils.dart index fc436d7..82da543 100644 --- a/packages/vector_math/test/test_utils.dart +++ b/packages/vector_math/test/test_utils.dart @@ -85,11 +85,7 @@ T parseMatrix(String input) { T parseVector(String v) { v = v.trim(); - final Pattern pattern = RegExp( - r'[\s]+', - multiLine: true, - caseSensitive: false, - ); + final Pattern pattern = RegExp(r'[\s]+', multiLine: true, caseSensitive: false); final List rows = v.split(pattern); final values = []; for (var i = 0; i < rows.length; i++) { diff --git a/packages/vector_math/test/vector3_list_test.dart b/packages/vector_math/test/vector3_list_test.dart index fa66019..719c163 100644 --- a/packages/vector_math/test/vector3_list_test.dart +++ b/packages/vector_math/test/vector3_list_test.dart @@ -64,11 +64,7 @@ void testVector3ListViewTightFit() { } void testVector3ListFromList() { - final input = [ - Vector3(1.0, 2.0, 3.0), - Vector3(4.0, 5.0, 6.0), - Vector3(7.0, 8.0, 9.0), - ]; + final input = [Vector3(1.0, 2.0, 3.0), Vector3(4.0, 5.0, 6.0), Vector3(7.0, 8.0, 9.0)]; final list = Vector3List.fromList(input, 2, 5); expect(list.buffer.length, 17); expect(list.buffer[0], 0.0); @@ -104,9 +100,7 @@ void testVector3ListSetValue() { } void testVector3ListSetZero() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.setZero(1); @@ -119,9 +113,7 @@ void testVector3ListSetZero() { } void testVector3ListAdd() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.add(1, $v3(2.0, 2.0, 2.0)); @@ -134,9 +126,7 @@ void testVector3ListAdd() { } void testVector3ListAddScaled() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.addScaled(1, $v3(2.0, 2.0, 2.0), 2.0); @@ -149,9 +139,7 @@ void testVector3ListAddScaled() { } void testVector3ListSub() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.sub(1, $v3(2.0, 2.0, 2.0)); @@ -164,9 +152,7 @@ void testVector3ListSub() { } void testVector3ListMultiply() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.multiply(1, $v3(2.0, 3.0, 4.0)); @@ -179,9 +165,7 @@ void testVector3ListMultiply() { } void testVector3ListScale() { - final list = Vector3List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), - ); + final list = Vector3List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])); list.scale(1, 2.0); diff --git a/packages/vector_math/test/vector3_test.dart b/packages/vector_math/test/vector3_test.dart index c29d944..9996680 100644 --- a/packages/vector_math/test/vector3_test.dart +++ b/packages/vector_math/test/vector3_test.dart @@ -116,8 +116,7 @@ void testVector3DotProduct() { } void testVector3Postmultiplication() { - final inputMatrix = - (Matrix3.rotationX(.4)) * (Matrix3.rotationZ(.5)) as Matrix3; + final inputMatrix = (Matrix3.rotationX(.4)) * (Matrix3.rotationZ(.5)) as Matrix3; final inputVector = Vector3(1.0, 2.0, 3.0); final inputInv = Matrix3.copy(inputMatrix); inputInv.invert(); @@ -251,17 +250,11 @@ void testVector3SetLength() { relativeTest(v0.length, 0.0); v1.length = 2.0; - relativeTest( - v1, - Vector3(1.4552137851715088, -0.9701424837112427, 0.9701424837112427), - ); + relativeTest(v1, Vector3(1.4552137851715088, -0.9701424837112427, 0.9701424837112427)); relativeTest(v1.length, 2.0); v2.length = 0.5; - relativeTest( - v2, - Vector3(-0.1666666716337204, 0.3333333432674408, -0.3333333432674408), - ); + relativeTest(v2, Vector3(-0.1666666716337204, 0.3333333432674408, -0.3333333432674408)); relativeTest(v2.length, 0.5); v3.length = -1.0; @@ -284,10 +277,7 @@ void testVector3Equals() { expect(v3 == Vector3(0.0, 2.0, 3.0), isFalse); expect(v3 == Vector3(1.0, 0.0, 3.0), isFalse); expect(v3 == Vector3(1.0, 2.0, 0.0), isFalse); - expect( - Vector3(1.0, 2.0, 3.0).hashCode, - equals(Vector3(1.0, 2.0, 3.0).hashCode), - ); + expect(Vector3(1.0, 2.0, 3.0).hashCode, equals(Vector3(1.0, 2.0, 3.0).hashCode)); } void testVector3Reflect() { @@ -350,24 +340,7 @@ void testVector3Projection() { final v = Vector3(1.0, 1.0, 1.0); const double a = 2.0 / 3.0; const double b = 1.0 / 3.0; - final m = Matrix4( - a, - b, - -b, - 0.0, - b, - a, - b, - 0.0, - -b, - b, - a, - 0.0, - 0.0, - 0.0, - 0.0, - 1.0, - ); + final m = Matrix4(a, b, -b, 0.0, b, a, b, 0.0, -b, b, a, 0.0, 0.0, 0.0, 0.0, 1.0); v.applyProjection(m); relativeTest(v.x, a); @@ -480,13 +453,9 @@ void testVector3RoundToZero() { void testVector3ApplyQuaternion() { final q = Quaternion(0.0, 0.9238795292366128, 0.0, 0.38268342717215614); - final v = Vector3(0.417267069084370, 0.049654430325742, 0.753423475845592) - ..applyQuaternion(q); + final v = Vector3(0.417267069084370, 0.049654430325742, 0.753423475845592)..applyQuaternion(q); - relativeTest( - v, - Vector3(0.23769846558570862, 0.04965442791581154, -0.8278031349182129), - ); + relativeTest(v, Vector3(0.23769846558570862, 0.04965442791581154, -0.8278031349182129)); } void main() { diff --git a/packages/vector_math/test/vector4_list_test.dart b/packages/vector_math/test/vector4_list_test.dart index f163c7c..e066dfc 100644 --- a/packages/vector_math/test/vector4_list_test.dart +++ b/packages/vector_math/test/vector4_list_test.dart @@ -112,9 +112,7 @@ void testVector4ListSetValue() { } void testVector4ListSetZero() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.setZero(1); @@ -129,9 +127,7 @@ void testVector4ListSetZero() { } void testVector4ListAdd() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.add(1, $v4(2.0, 2.0, 2.0, 2.0)); @@ -146,9 +142,7 @@ void testVector4ListAdd() { } void testVector4ListAddScaled() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.addScaled(1, $v4(2.0, 2.0, 2.0, 2.0), 2.0); @@ -163,9 +157,7 @@ void testVector4ListAddScaled() { } void testVector4ListSub() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.sub(1, $v4(2.0, 2.0, 2.0, 2.0)); @@ -180,9 +172,7 @@ void testVector4ListSub() { } void testVector4ListMultiply() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.multiply(1, $v4(2.0, 3.0, 4.0, 5.0)); @@ -197,9 +187,7 @@ void testVector4ListMultiply() { } void testVector4ListScale() { - final list = Vector4List.view( - Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]), - ); + final list = Vector4List.view(Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])); list.scale(1, 2.0); diff --git a/packages/vector_math/test/vector4_test.dart b/packages/vector_math/test/vector4_test.dart index 652a19a..a17344d 100644 --- a/packages/vector_math/test/vector4_test.dart +++ b/packages/vector_math/test/vector4_test.dart @@ -148,24 +148,14 @@ void testVector4SetLength() { v1.length = 2.0; relativeTest( v1, - Vector4( - 1.4142135381698608, - -0.9428090453147888, - 0.9428090453147888, - 0.4714045226573944, - ), + Vector4(1.4142135381698608, -0.9428090453147888, 0.9428090453147888, 0.4714045226573944), ); relativeTest(v1.length, 2.0); v2.length = 0.5; relativeTest( v2, - Vector4( - -0.1178511306643486, - 0.2357022613286972, - -0.2357022613286972, - -0.3535533845424652, - ), + Vector4(-0.1178511306643486, 0.2357022613286972, -0.2357022613286972, -0.3535533845424652), ); relativeTest(v2.length, 0.5); @@ -190,10 +180,7 @@ void testVector4Equals() { expect(v4 == Vector4(1.0, 0.0, 3.0, 4.0), isFalse); expect(v4 == Vector4(1.0, 2.0, 0.0, 4.0), isFalse); expect(v4 == Vector4(1.0, 2.0, 3.0, 0.0), isFalse); - expect( - Vector4(1.0, 2.0, 3.0, 4.0).hashCode, - equals(Vector4(1.0, 2.0, 3.0, 4.0).hashCode), - ); + expect(Vector4(1.0, 2.0, 3.0, 4.0).hashCode, equals(Vector4(1.0, 2.0, 3.0, 4.0).hashCode)); } void testVector4DistanceTo() { diff --git a/packages/vector_math/tool/generate_vector_math_64.dart b/packages/vector_math/tool/generate_vector_math_64.dart index 4a4e788..85ffa49 100644 --- a/packages/vector_math/tool/generate_vector_math_64.dart +++ b/packages/vector_math/tool/generate_vector_math_64.dart @@ -30,9 +30,7 @@ Future generateVectorMath64() async { await directory.create(recursive: true); await _processFile('lib/vector_math.dart'); - await for (final FileSystemEntity f in Directory( - 'lib/src/vector_math/', - ).list(recursive: true)) { + await for (final FileSystemEntity f in Directory('lib/src/vector_math/').list(recursive: true)) { if (f is File) { await _processFile(f.path); } @@ -45,10 +43,7 @@ Future _processFile(String inputFileName) async { final String input = await inputFile.readAsString(); final String output = _convertToVectorMath64(input); - final String outputFileName = inputFileName.replaceAll( - 'vector_math', - 'vector_math_64', - ); + final String outputFileName = inputFileName.replaceAll('vector_math', 'vector_math_64'); final dir = Directory(p.dirname(outputFileName)); await dir.create(recursive: true); @@ -57,6 +52,5 @@ Future _processFile(String inputFileName) async { await outputFile.writeAsString(output); } -String _convertToVectorMath64(String input) => input - .replaceAll('vector_math', 'vector_math_64') - .replaceAll('Float32List', 'Float64List'); +String _convertToVectorMath64(String input) => + input.replaceAll('vector_math', 'vector_math_64').replaceAll('Float32List', 'Float64List'); From d8bfdb4a2f05ce2adc865a86b11f2237022bbcb4 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Jun 2026 14:35:42 -0400 Subject: [PATCH 3/4] dart fix --apply --- packages/vector_math/lib/src/vector_math/vector.dart | 2 +- packages/vector_math/lib/src/vector_math_64/vector.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vector_math/lib/src/vector_math/vector.dart b/packages/vector_math/lib/src/vector_math/vector.dart index 6c90c37..9244c56 100644 --- a/packages/vector_math/lib/src/vector_math/vector.dart +++ b/packages/vector_math/lib/src/vector_math/vector.dart @@ -36,7 +36,7 @@ void cross2B(Vector2 x, double y, Vector2 out) { /// Sets [u] and [v] to be two vectors orthogonal to each other and /// [planeNormal]. -void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { +void buildPlaneVectors(Vector3 planeNormal, Vector3 u, Vector3 v) { if (planeNormal.z.abs() > math.sqrt1_2) { // choose u in y-z plane final double a = planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; diff --git a/packages/vector_math/lib/src/vector_math_64/vector.dart b/packages/vector_math/lib/src/vector_math_64/vector.dart index 2224619..a6777ef 100644 --- a/packages/vector_math/lib/src/vector_math_64/vector.dart +++ b/packages/vector_math/lib/src/vector_math_64/vector.dart @@ -36,7 +36,7 @@ void cross2B(Vector2 x, double y, Vector2 out) { /// Sets [u] and [v] to be two vectors orthogonal to each other and /// [planeNormal]. -void buildPlaneVectors(final Vector3 planeNormal, Vector3 u, Vector3 v) { +void buildPlaneVectors(Vector3 planeNormal, Vector3 u, Vector3 v) { if (planeNormal.z.abs() > math.sqrt1_2) { // choose u in y-z plane final double a = planeNormal.y * planeNormal.y + planeNormal.z * planeNormal.z; From 8e6e42b0a95e7b2e6ebb3556f53997acf87e03b7 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 3 Jun 2026 14:42:19 -0400 Subject: [PATCH 4/4] Don't locally disable a setting we don't need to disable here --- analysis_options.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index dfc3bd2..2831f71 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -113,7 +113,7 @@ linter: - implicit_call_tearoffs - implicit_reopen - invalid_case_patterns - # - invalid_runtime_check_with_js_interop_types # DIFFERENT FROM FLUTTER/FLUTTER temporarily disabled due to https://github.com/flutter/flutter/issues/187454 + - invalid_runtime_check_with_js_interop_types # - join_return_with_assignment # not required by flutter style - leading_newlines_in_multiline_strings - library_annotations