diff --git a/doc/animation_widget_article/article.md b/doc/animation_widget_article/article.md index 8907ccefd..b72a54199 100644 --- a/doc/animation_widget_article/article.md +++ b/doc/animation_widget_article/article.md @@ -118,12 +118,12 @@ Let's you have your `build` method in one of your pages; pretty normal Flutter s } ``` -Note that it could be any component, however complex, inside your widgets tree. Note also that I have omitted the "magic" of the equation here. How is it that we create a component for an animation? Very basically (more details in the flame tutorial), Flame provides components, one of which is the `SpriteAnimationComponent` that receives a `SpriteAnimation` object describing the animation and does exactly what we want. All components live inside a `Game` instance, that can add custom logic relating to the game loop. For our case, we just want to create a simple, empty game and add a single `AnimationComponent` with a simple `Animation` inside. So Flame provides a helper to do that, the `Flame.util.animationAsWidget` method. It takes the size of the object as a Flame's `Position` instance (a generic class to represent a pair of doubles), and also takes in an `Animation` instance representing our frame list. To use that, let's import both `Flame` and the `Animation` class. However, since Flutter adds it's own animation classes, let's use an alias in order to not mess up the names. Therefore, add these imports to the top of the file: +Note that it could be any component, however complex, inside your widgets tree. Note also that I have omitted the "magic" of the equation here. How do we create a component for an animation? Very basically (more details in the flame tutorial), Flame provides components, one of which is the `SpriteAnimationComponent` that receives a `SpriteAnimation` object describing the animation and does exactly what we want. All components live inside a `Game` instance, that can add custom logic relating to the game loop. For our case, we just want to create a simple, empty game and add a single `AnimationComponent` with a simple `Animation` inside. So Flame provides a helper to do that, the `Flame.util.animationAsWidget` method. It takes the size of the object as a Flame's `Position` instance (a generic class to represent a pair of doubles), and also takes in an `Animation` instance representing our frame list. To use that, let's import both `Flame` and the `Animation` class. However, since Flutter adds it's own animation classes, let's use an alias in order to not mess up the names. Therefore, add these imports to the top of the file: ```dart import 'package:flame/sprite_animation.dart'; // imports the SpriteAnimation class import 'package:flame/flame.dart'; // imports the Flame helper class -import 'package:flame/vector.dart'; // imports the Vector2 class +import 'package:flame/vector2.dart'; // imports the Vector2 class ``` How do we do the magic then? Just add the following to your widget tree: diff --git a/doc/examples/animations/lib/main.dart b/doc/examples/animations/lib/main.dart index 98868c776..7e52caced 100644 --- a/doc/examples/animations/lib/main.dart +++ b/doc/examples/animations/lib/main.dart @@ -2,7 +2,7 @@ import 'package:flame/gestures.dart'; import 'package:flutter/gestures.dart'; import 'package:flame/flame.dart'; import 'package:flame/game.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/sprite_animation.dart'; import 'package:flame/components/sprite_animation_component.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/aseprite/lib/main.dart b/doc/examples/aseprite/lib/main.dart index e1e54df2a..951bdd36f 100644 --- a/doc/examples/aseprite/lib/main.dart +++ b/doc/examples/aseprite/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flame/sprite_animation.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/components/sprite_animation_component.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/audiopool/lib/main.dart b/doc/examples/audiopool/lib/main.dart index 09085d23b..14dd91299 100644 --- a/doc/examples/audiopool/lib/main.dart +++ b/doc/examples/audiopool/lib/main.dart @@ -7,7 +7,7 @@ import 'package:flame/game.dart'; import 'package:flame/palette.dart'; import 'package:flame/text_config.dart'; import 'package:flame/gestures.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/material.dart'; void main() async { diff --git a/doc/examples/debug/lib/main.dart b/doc/examples/debug/lib/main.dart index ef56a944e..8d1b70595 100644 --- a/doc/examples/debug/lib/main.dart +++ b/doc/examples/debug/lib/main.dart @@ -1,6 +1,6 @@ import 'package:flame/game.dart'; import 'package:flame/flame.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/components/sprite_component.dart'; import 'package:flame/components/mixins/resizable.dart'; import 'package:flame/text_config.dart'; diff --git a/doc/examples/effects/combined_effects/lib/main.dart b/doc/examples/effects/combined_effects/lib/main.dart index 9c1c4d460..7d08c15b5 100644 --- a/doc/examples/effects/combined_effects/lib/main.dart +++ b/doc/examples/effects/combined_effects/lib/main.dart @@ -3,7 +3,7 @@ import 'package:flame/effects/move_effect.dart'; import 'package:flame/effects/scale_effect.dart'; import 'package:flame/effects/rotate_effect.dart'; import 'package:flame/gestures.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/effects/infinite_effects/lib/main.dart b/doc/examples/effects/infinite_effects/lib/main.dart index 20cf7361f..9bf981f6d 100644 --- a/doc/examples/effects/infinite_effects/lib/main.dart +++ b/doc/examples/effects/infinite_effects/lib/main.dart @@ -2,7 +2,7 @@ import 'package:flame/effects/move_effect.dart'; import 'package:flame/effects/scale_effect.dart'; import 'package:flame/effects/rotate_effect.dart'; import 'package:flame/gestures.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/effects/sequence_effect/lib/main.dart b/doc/examples/effects/sequence_effect/lib/main.dart index f37caeac3..0caabe4c7 100644 --- a/doc/examples/effects/sequence_effect/lib/main.dart +++ b/doc/examples/effects/sequence_effect/lib/main.dart @@ -3,7 +3,7 @@ import 'package:flame/effects/scale_effect.dart'; import 'package:flame/effects/rotate_effect.dart'; import 'package:flame/effects/sequence_effect.dart'; import 'package:flame/gestures.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/effects/simple/lib/main_move.dart b/doc/examples/effects/simple/lib/main_move.dart index 57431cf4f..db5e53ec8 100644 --- a/doc/examples/effects/simple/lib/main_move.dart +++ b/doc/examples/effects/simple/lib/main_move.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flame/game.dart'; import 'package:flame/gestures.dart'; import 'package:flame/effects/effects.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import './square.dart'; @@ -17,7 +17,7 @@ class MyGame extends BaseGame with TapDetector { @override void onTapUp(details) { square.addEffect(MoveEffect( - destination: VectorUtil.fromOffset(details.localPosition), + destination: Vector2Operations.fromOffset(details.localPosition), speed: 250.0, curve: Curves.bounceInOut, )); diff --git a/doc/examples/effects/simple/lib/main_scale.dart b/doc/examples/effects/simple/lib/main_scale.dart index 2c141937b..cf02573d2 100644 --- a/doc/examples/effects/simple/lib/main_scale.dart +++ b/doc/examples/effects/simple/lib/main_scale.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flame/game.dart'; import 'package:flame/gestures.dart'; import 'package:flame/anchor.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/effects/effects.dart'; import './square.dart'; diff --git a/doc/examples/joystick/lib/player.dart b/doc/examples/joystick/lib/player.dart index c6e0fdd3f..b12f6da3e 100644 --- a/doc/examples/joystick/lib/player.dart +++ b/doc/examples/joystick/lib/player.dart @@ -5,7 +5,7 @@ import 'package:flame/components/component.dart'; import 'package:flame/components/joystick/joystick_component.dart'; import 'package:flame/components/joystick/joystick_events.dart'; import 'package:flame/palette.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; class Player extends Component implements JoystickListener { final _whitePaint = BasicPalette.white.paint; diff --git a/doc/examples/parallax/lib/main.dart b/doc/examples/parallax/lib/main.dart index 05dc621f5..e16125029 100644 --- a/doc/examples/parallax/lib/main.dart +++ b/doc/examples/parallax/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flame/components/parallax_component.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/material.dart'; void main() async { diff --git a/doc/examples/particles/lib/main.dart b/doc/examples/particles/lib/main.dart index 9685488bf..66a738895 100644 --- a/doc/examples/particles/lib/main.dart +++ b/doc/examples/particles/lib/main.dart @@ -21,7 +21,7 @@ import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flame/time.dart' as flame_time; import 'package:flame/particle.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/sprite.dart'; import 'package:flame/spritesheet.dart'; import 'package:flame/text_config.dart'; @@ -108,7 +108,7 @@ class MyGame extends BaseGame { // lifecycle from the [BaseGame]. TranslatedParticle( lifespan: 1, - offset: VectorUtil.toOffset(cellCenter), + offset: Vector2Operations.toOffset(cellCenter), child: particle, ).asComponent(), ); @@ -405,8 +405,8 @@ class MyGame extends BaseGame { /// which is independent from the parent [Particle]. Particle componentParticle() { return MovingParticle( - from: VectorUtil.toOffset(-halfCellSize * .2), - to: VectorUtil.toOffset(halfCellSize * .2), + from: Vector2Operations.toOffset(-halfCellSize * .2), + to: Vector2Operations.toOffset(halfCellSize * .2), curve: SineCurve(), child: ComponentParticle(component: trafficLight), ); @@ -473,8 +473,8 @@ class MyGame extends BaseGame { ), ); - final cellSizeOffset = VectorUtil.toOffset(cellSize); - final halfCellSizeOffset = VectorUtil.toOffset(halfCellSize); + final cellSizeOffset = Vector2Operations.toOffset(cellSize); + final halfCellSizeOffset = Vector2Operations.toOffset(halfCellSize); return ComposedParticle(children: [ rect diff --git a/doc/examples/render_flip/lib/main.dart b/doc/examples/render_flip/lib/main.dart index e319f1da4..e4ff78c4a 100644 --- a/doc/examples/render_flip/lib/main.dart +++ b/doc/examples/render_flip/lib/main.dart @@ -2,7 +2,7 @@ import 'package:flame/sprite_animation.dart'; import 'package:flame/components/sprite_animation_component.dart'; import 'package:flame/flame.dart'; import 'package:flame/game.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/material.dart'; void main() async { diff --git a/doc/examples/sound/lib/main.dart b/doc/examples/sound/lib/main.dart index acc8ed017..f1f8f13cf 100644 --- a/doc/examples/sound/lib/main.dart +++ b/doc/examples/sound/lib/main.dart @@ -1,6 +1,6 @@ import 'package:flame/flame.dart'; import 'package:flame/game.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flame/components/position_component.dart'; import 'package:flutter/material.dart'; diff --git a/doc/examples/text/lib/main.dart b/doc/examples/text/lib/main.dart index 0f31c5185..ab0f06dd6 100644 --- a/doc/examples/text/lib/main.dart +++ b/doc/examples/text/lib/main.dart @@ -7,7 +7,7 @@ import 'package:flame/flame.dart'; import 'package:flame/game.dart'; import 'package:flame/palette.dart'; import 'package:flame/text_config.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/material.dart'; void main() async { diff --git a/doc/util.md b/doc/util.md index 6c0019d16..8e339d247 100644 --- a/doc/util.md +++ b/doc/util.md @@ -60,7 +60,7 @@ import 'dart:ui'; import 'package:flame/game.dart'; import 'package:flame/text_config.dart'; import 'package:flame/time.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; class MyGame extends Game { final TextConfig textConfig = TextConfig(color: const Color(0xFFFFFFFF)); @@ -95,7 +95,7 @@ import 'dart:ui'; import 'package:flame/game.dart'; import 'package:flame/text_config.dart'; import 'package:flame/time.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; class MyGame extends Game { final TextConfig textConfig = TextConfig(color: const Color(0xFFFFFFFF)); diff --git a/lib/components/joystick/joystick_action.dart b/lib/components/joystick/joystick_action.dart index fe88ddb13..7fff42410 100644 --- a/lib/components/joystick/joystick_action.dart +++ b/lib/components/joystick/joystick_action.dart @@ -6,11 +6,11 @@ import 'package:flame/components/joystick/joystick_component.dart'; import 'package:flame/components/joystick/joystick_events.dart'; import 'package:flame/gestures.dart'; import 'package:flame/sprite.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import '../../vector.dart'; +import '../../vector2.dart'; enum JoystickActionAlign { TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT } @@ -156,8 +156,8 @@ class JoystickAction { // Distance between the center of joystick background & drag position final centerPosition = - VectorUtil.fromOffset(_rectBackgroundDirection.center); - final dragPosition = VectorUtil.fromOffset(_dragPosition); + Vector2Operations.fromOffset(_rectBackgroundDirection.center); + final dragPosition = Vector2Operations.fromOffset(_dragPosition); double dist = centerPosition.distanceTo(dragPosition); // The maximum distance for the knob position to the edge of diff --git a/lib/components/joystick/joystick_component.dart b/lib/components/joystick/joystick_component.dart index 946bb1e0f..d6bf11ace 100644 --- a/lib/components/joystick/joystick_component.dart +++ b/lib/components/joystick/joystick_component.dart @@ -7,7 +7,7 @@ import 'package:flame/components/joystick/joystick_events.dart'; import 'package:flame/components/mixins/has_game_ref.dart'; import 'package:flame/game/base_game.dart'; import 'package:flame/gestures.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; mixin JoystickListener { void joystickChangeDirectional(JoystickDirectionalEvent event); diff --git a/lib/components/joystick/joystick_directional.dart b/lib/components/joystick/joystick_directional.dart index 6d72a348e..1d2d8e75e 100644 --- a/lib/components/joystick/joystick_directional.dart +++ b/lib/components/joystick/joystick_directional.dart @@ -6,7 +6,7 @@ import 'package:flame/gestures.dart'; import 'package:flame/sprite.dart'; import 'package:flutter/material.dart'; -import '../../vector.dart'; +import '../../vector2.dart'; class JoystickDirectional { final double size; @@ -117,8 +117,8 @@ class JoystickDirectional { final double degrees = _radAngle * 180 / pi; // Distance between the center of joystick background & drag position - final centerPosition = VectorUtil.fromOffset(_backgroundRect.center); - final dragPosition = VectorUtil.fromOffset(_dragPosition); + final centerPosition = Vector2Operations.fromOffset(_backgroundRect.center); + final dragPosition = Vector2Operations.fromOffset(_dragPosition); double dist = centerPosition.distanceTo(dragPosition); // The maximum distance for the knob position the edge of diff --git a/lib/game/game.dart b/lib/game/game.dart index aeb6d418b..89457a30f 100644 --- a/lib/game/game.dart +++ b/lib/game/game.dart @@ -9,7 +9,7 @@ import 'package:flutter/services.dart'; import '../keyboard.dart'; -import '../vector.dart'; +import '../vector2.dart'; import 'widget_builder.dart'; /// Represents a generic game. diff --git a/lib/game/game_render_box.dart b/lib/game/game_render_box.dart index db4d6ae91..e03000d99 100644 --- a/lib/game/game_render_box.dart +++ b/lib/game/game_render_box.dart @@ -5,7 +5,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart' hide WidgetBuilder; -import '../vector.dart'; +import '../vector2.dart'; import 'game_loop.dart'; import 'game.dart'; @@ -24,7 +24,7 @@ class GameRenderBox extends RenderBox with WidgetsBindingObserver { @override void performResize() { super.performResize(); - game.resize(VectorUtil.fromSize(constraints.biggest)); + game.resize(Vector2Operations.fromSize(constraints.biggest)); } @override diff --git a/lib/particles/image_particle.dart b/lib/particles/image_particle.dart index 46c4582a7..a1a5851c8 100644 --- a/lib/particles/image_particle.dart +++ b/lib/particles/image_particle.dart @@ -3,7 +3,7 @@ import 'dart:ui'; import 'package:flutter/foundation.dart'; import '../particle.dart'; -import '../vector.dart'; +import '../vector2.dart'; /// A [Particle] which renders given [Image] on a [Canvas] /// image is centered. If any other behavior is needed, consider diff --git a/lib/sprite.dart b/lib/sprite.dart index 3d37406b8..c2a026297 100644 --- a/lib/sprite.dart +++ b/lib/sprite.dart @@ -6,7 +6,7 @@ import 'package:vector_math/vector_math_64.dart'; import 'flame.dart'; import 'palette.dart'; -import 'vector.dart'; +import 'vector2.dart'; class Sprite { Paint paint = BasicPalette.white.paint; @@ -95,7 +95,7 @@ class Sprite { return; } size ??= this.size; - renderRect(canvas, VectorUtil.rectFrom(p, size), + renderRect(canvas, Vector2Operations.rectFrom(p, size), overridePaint: overridePaint); } diff --git a/lib/sprite_batch.dart b/lib/sprite_batch.dart index a3a04e3d1..5940c84ce 100644 --- a/lib/sprite_batch.dart +++ b/lib/sprite_batch.dart @@ -3,7 +3,7 @@ import 'dart:ui'; import 'package:flutter/foundation.dart'; import 'flame.dart'; -import 'vector.dart'; +import 'vector2.dart'; /// sprite atlas with an image and a set of rects and transforms class SpriteBatch { diff --git a/lib/text_config.dart b/lib/text_config.dart index 0fda5eedb..df49e7328 100644 --- a/lib/text_config.dart +++ b/lib/text_config.dart @@ -5,7 +5,7 @@ import 'package:vector_math/vector_math_64.dart'; import 'anchor.dart'; import 'memory_cache.dart'; -import 'vector.dart'; +import 'vector2.dart'; /// A Text Config contains all typographical information required to render texts; i.e., font size and color, family, etc. /// @@ -81,8 +81,8 @@ class TextConfig { {Anchor anchor = Anchor.topLeft}) { final material.TextPainter tp = toTextPainter(text); final Vector2 translatedPosition = - anchor.translate(p, VectorUtil.fromSize(tp.size)); - tp.paint(canvas, VectorUtil.toOffset(translatedPosition)); + anchor.translate(p, Vector2Operations.fromSize(tp.size)); + tp.paint(canvas, Vector2Operations.toOffset(translatedPosition)); } /// Returns a [material.TextPainter] that allows for text rendering and size measuring. diff --git a/lib/util.dart b/lib/util.dart index d301f69f9..eda630c19 100644 --- a/lib/util.dart +++ b/lib/util.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:ui'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; import 'package:flutter/foundation.dart'; @@ -105,13 +105,13 @@ class Util { final completer = Completer(); window.onMetricsChanged = () { if (!window.physicalSize.isEmpty && !completer.isCompleted) { - completer.complete(VectorUtil.fromSize( + completer.complete(Vector2Operations.fromSize( window.physicalSize / window.devicePixelRatio)); } }; return completer.future; } - return VectorUtil.fromSize(window.physicalSize / window.devicePixelRatio); + return Vector2Operations.fromSize(window.physicalSize / window.devicePixelRatio); }); } diff --git a/lib/vector.dart b/lib/vector2.dart similarity index 99% rename from lib/vector.dart rename to lib/vector2.dart index bd02d1001..431abe248 100644 --- a/lib/vector.dart +++ b/lib/vector2.dart @@ -6,7 +6,7 @@ import 'dart:math'; import 'dart:ui'; import 'package:vector_math/vector_math_64.dart'; -class VectorUtil { +class Vector2Operations { /// Creates converting integers to double. /// /// Internal representation is still using double, the conversion is made in the constructor only. diff --git a/test/components/component_test.dart b/test/components/component_test.dart index 064d3f686..0bc4a701b 100644 --- a/test/components/component_test.dart +++ b/test/components/component_test.dart @@ -2,7 +2,7 @@ import 'dart:ui'; import 'package:flame/components/position_component.dart'; import 'package:flame/components/sprite_component.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:test/test.dart'; void main() { diff --git a/test/components/composed_component_test.dart b/test/components/composed_component_test.dart index 02d2762b2..20d85a603 100644 --- a/test/components/composed_component_test.dart +++ b/test/components/composed_component_test.dart @@ -5,7 +5,7 @@ import 'package:flame/components/mixins/has_game_ref.dart'; import 'package:flame/components/mixins/resizable.dart'; import 'package:flame/components/mixins/tapable.dart'; import 'package:flame/game/base_game.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:flutter/gestures.dart'; import 'package:test/test.dart'; diff --git a/test/components/resizable_test.dart b/test/components/resizable_test.dart index 29eb45254..8dd8d77b7 100644 --- a/test/components/resizable_test.dart +++ b/test/components/resizable_test.dart @@ -1,5 +1,5 @@ import 'package:flame/game/base_game.dart'; -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:test/test.dart'; import 'package:flame/components/position_component.dart'; diff --git a/test/position_test.dart b/test/position_test.dart index 5dad5dde1..4c5377376 100644 --- a/test/position_test.dart +++ b/test/position_test.dart @@ -1,4 +1,4 @@ -import 'package:flame/vector.dart'; +import 'package:flame/vector2.dart'; import 'package:test/test.dart'; import 'dart:math' as math; @@ -25,7 +25,7 @@ void main() { test('test rotate', () { final Vector2 p = Vector2(1.0, 0.0); - VectorUtil.rotate(p, math.pi / 2); + Vector2Operations.rotate(p, math.pi / 2); expectDouble(p.x, 0.0); expectDouble(p.y, 1.0); }); @@ -67,12 +67,12 @@ void main() { }); test('scaleTo', () { - final Vector2 p = VectorUtil.rotated(Vector2(1.0, 0.0), math.pi / 4); - VectorUtil.scaleTo(p, 2.0); + final Vector2 p = Vector2Operations.rotated(Vector2(1.0, 0.0), math.pi / 4); + Vector2Operations.scaleTo(p, 2.0); expect(p.length, 2.0); - VectorUtil.rotate(p, -math.pi / 4); + Vector2Operations.rotate(p, -math.pi / 4); expect(p.length, 2.0); expect(p.x, 2.0); expect(p.y, 0.0);