From: Svjatoslav Agejenko Date: Wed, 11 Jul 2018 00:36:08 +0000 (+0300) Subject: Refactoring. X-Git-Tag: sixth-3d-1.2~36 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=commitdiff_plain;h=baab2e2c2ad89695293f3136311c585c9a5afed1 Refactoring. --- diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/GeometryCoordinate.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/GeometryCoordinate.java deleted file mode 100644 index 48b72d2..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/GeometryCoordinate.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.geometry; - -import eu.svjatoslav.sixth.e3d.gui.RenderingContext; - -public class GeometryCoordinate { - - public Point3D coordinate; - public Point3D transformedCoordinate; - public Point2D onScreenCoordinate; - - int lastTransformedFrame; - - public GeometryCoordinate() { - coordinate = new Point3D(); - transformedCoordinate = new Point3D(); - onScreenCoordinate = new Point2D(); - } - - public GeometryCoordinate(final Point3D location) { - coordinate = location; - transformedCoordinate = new Point3D(); - onScreenCoordinate = new Point2D(); - } - - public void transform(final TransformPipe transforms, - final RenderingContext renderContext) { - - if (lastTransformedFrame == renderContext.frameNumber) - return; - - lastTransformedFrame = renderContext.frameNumber; - - transforms.transform(coordinate, transformedCoordinate); - - onScreenCoordinate.x = ((transformedCoordinate.x / transformedCoordinate.z) * renderContext.zoom) - + renderContext.xCenter; - onScreenCoordinate.y = ((transformedCoordinate.y / transformedCoordinate.z) * renderContext.zoom) - + renderContext.yCenter; - } -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Orientation.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Orientation.java deleted file mode 100644 index 540c60b..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Orientation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - - -package eu.svjatoslav.sixth.e3d.geometry; - -public class Orientation implements Cloneable { - - private double s1, c1, s2, c2; - - private double angleXZ = 0; - private double angleYZ = 0; - - public Orientation() { - computeMultipliers(); - } - - public Orientation(final double angleXZ, final double angleYZ) { - this.angleXZ = angleXZ; - this.angleYZ = angleYZ; - computeMultipliers(); - } - - @Override - public Orientation clone() { - return new Orientation(angleXZ, angleYZ); - } - - private void computeMultipliers() { - s1 = Math.sin(angleXZ); - c1 = Math.cos(angleXZ); - - s2 = Math.sin(angleYZ); - c2 = Math.cos(angleYZ); - } - - public void rotate(final Point3D point3d) { - final double z1 = (point3d.z * c1) - (point3d.x * s1); - point3d.x = (point3d.z * s1) + (point3d.x * c1); - - point3d.z = (z1 * c2) - (point3d.y * s2); - point3d.y = (z1 * s2) + (point3d.y * c2); - } - - public void rotate(final double angleXZ, final double angleYZ) { - this.angleXZ += angleXZ; - this.angleYZ += angleYZ; - computeMultipliers(); - } - -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java index f8fbef9..1cfd39c 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java @@ -9,6 +9,8 @@ package eu.svjatoslav.sixth.e3d.geometry; +import static java.lang.Math.sqrt; + public class Point2D implements Cloneable { public double x, y; @@ -32,6 +34,10 @@ public class Point2D implements Cloneable { return this; } + public boolean isZero(){ + return (x == 0) && (y == 0); + } + @Override public Point2D clone() { return new Point2D(this); @@ -42,7 +48,7 @@ public class Point2D implements Cloneable { y = source.y; } - public Point2D computeMiddlePoint(final Point2D p1, final Point2D p2) { + public Point2D getMiddle(final Point2D p1, final Point2D p2) { x = (p1.x + p2.x) / 2d; y = (p1.y + p2.y) / 2d; return this; @@ -52,11 +58,18 @@ public class Point2D implements Cloneable { return Math.atan2(x - anotherPoint.x, y - anotherPoint.y); } + /** + * Compute distance to another point. + */ public double getDistanceTo(final Point2D anotherPoint) { final double xDiff = x - anotherPoint.x; final double yDiff = y - anotherPoint.y; - return Math.sqrt(((xDiff * xDiff) + (yDiff * yDiff))); + return sqrt(((xDiff * xDiff) + (yDiff * yDiff))); + } + + public double getVectorLength() { + return sqrt(((x * x) + (y * y))); } public Point2D invert() { @@ -70,9 +83,9 @@ public class Point2D implements Cloneable { y = (int) y; } - public Point2D subtract(final Point2D direction) { - x -= direction.x; - y -= direction.y; + public Point2D subtract(final Point2D point) { + x -= point.x; + y -= point.y; return this; } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java index 0b28de2..462f310 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java @@ -9,13 +9,16 @@ package eu.svjatoslav.sixth.e3d.geometry; +import static java.lang.Math.cos; +import static java.lang.Math.sin; +import static java.lang.Math.sqrt; + /** - * Used to represent point in a 3D space, vector or speed. + * Used to represent point in a 3D space or vector. */ public class Point3D extends Point2D implements Cloneable { - public static final Point3D ZERO = new Point3D(); public double z; public Point3D() { @@ -70,6 +73,11 @@ public class Point3D extends Point2D implements Cloneable { return this; } + @Override + public boolean isZero(){ + return (x == 0) && (y == 0) && (z == 0); + } + public double getAngleXZ(final Point3D anotherPoint) { return Math.atan2(x - anotherPoint.x, z - anotherPoint.z); } @@ -86,8 +94,12 @@ public class Point3D extends Point2D implements Cloneable { final double yDelta = y - anotherPoint.y; final double zDelta = z - anotherPoint.z; - return Math - .sqrt(((xDelta * xDelta) + (yDelta * yDelta) + (zDelta * zDelta))); + return sqrt(((xDelta * xDelta) + (yDelta * yDelta) + (zDelta * zDelta))); + } + + @Override + public double getVectorLength() { + return sqrt(((x * x) + (y * y) + (z * z))); } @Override @@ -100,11 +112,11 @@ public class Point3D extends Point2D implements Cloneable { public void rotate(final Point3D center, final double angleXZ, final double angleYZ) { - final double s1 = Math.sin(angleXZ); - final double c1 = Math.cos(angleXZ); + final double s1 = sin(angleXZ); + final double c1 = cos(angleXZ); - final double s2 = Math.sin(angleYZ); - final double c2 = Math.cos(angleYZ); + final double s2 = sin(angleYZ); + final double c2 = cos(angleYZ); x -= center.x; y -= center.y; @@ -174,7 +186,7 @@ public class Point3D extends Point2D implements Cloneable { return this; } - public boolean withinDrawingLimits() { + public boolean isVisible() { if (z > 0) return true; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Transform.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Transform.java deleted file mode 100755 index 374880f..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Transform.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.geometry; - -public class Transform implements Cloneable { - - private final Point3D translation; - private final Orientation orientation; - - public Transform() { - translation = new Point3D(); - orientation = new Orientation(); - } - - public Transform(final Point3D translation) { - this.translation = translation; - orientation = new Orientation(); - } - - public Transform(final Point3D translation, final double angleXZ, - final double angleYZ) { - - this.translation = translation; - orientation = new Orientation(angleXZ, angleYZ); - } - - public Transform(final Point3D translation, final Orientation orientation) { - this.translation = translation; - this.orientation = orientation; - } - - @Override - public Transform clone() { - return new Transform(translation, orientation); - } - - public Orientation getOrientation() { - return orientation; - } - - public Point3D getTranslation() { - return translation; - } - - public void transform(final Point3D point) { - orientation.rotate(point); - point.add(translation); - } - -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/TransformPipe.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/TransformPipe.java deleted file mode 100644 index 7df7991..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/TransformPipe.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.geometry; - -public class TransformPipe { - - private Transform[] transforms = new Transform[100]; - - private int transformsCount = 0; - - public void addTransform(final Transform transform) { - transforms[transformsCount] = transform; - transformsCount++; - } - - public void clear() { - transformsCount = 0; - } - - public void dropTransform() { - transformsCount--; - } - - public void transform(final Point3D source, final Point3D destination) { - - destination.clone(source); - - for (int i = transformsCount - 1; i >= 0; i--) - transforms[i].transform(destination); - } -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java index 6e4c5ec..7f0f698 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java @@ -14,7 +14,7 @@ import eu.svjatoslav.sixth.e3d.geometry.Point3D; import static java.lang.Math.cos; import static java.lang.Math.sin; -public class Avatar implements ViewUpdateListener { +public class Avatar implements ViewRenderListener { public static final double SPEED_LIMIT = 30; /** @@ -70,7 +70,7 @@ public class Avatar implements ViewUpdateListener { } @Override - public boolean beforeViewUpdate(final ViewContext viewContext, final int millisecondsSinceLastFrame) { + public boolean beforeRender(final ViewContext viewContext, final int millisecondsSinceLastFrame) { final Point3D locationBeforeUpdate = new Point3D(location); translateAvatarLocation(millisecondsSinceLastFrame); @@ -84,8 +84,7 @@ public class Avatar implements ViewUpdateListener { } public void enforceSpeedLimit() { - final double currentSpeed = movementVector - .getDistanceTo(Point3D.ZERO); + final double currentSpeed = movementVector.getVectorLength(); if (currentSpeed <= SPEED_LIMIT) return; @@ -122,7 +121,7 @@ public class Avatar implements ViewUpdateListener { } public double getMovementSpeed() { - return movementVector.getDistanceTo(Point3D.ZERO); + return movementVector.getVectorLength(); } private void applyFrictionToUserMovement(int millisecondsPassedSinceLastFrame) { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java index 3eb7d8b..8ab5c90 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java @@ -11,7 +11,7 @@ package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.geometry.Box; import eu.svjatoslav.sixth.e3d.geometry.Point3D; -import eu.svjatoslav.sixth.e3d.geometry.Transform; +import eu.svjatoslav.sixth.e3d.math.Transform; import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController; import eu.svjatoslav.sixth.e3d.gui.humaninput.UserInputHandler; import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.KeyboardHelper; @@ -39,8 +39,8 @@ public class GuiComponent extends AbstractCompositeShape implements } @Override - public boolean beforeViewUpdate(final ViewContext viewContext, - final int millisecondsSinceLastFrame) { + public boolean beforeRender(final ViewContext viewContext, + final int millisecondsSinceLastFrame) { return false; } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java index d183325..175c10a 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java @@ -10,13 +10,13 @@ package eu.svjatoslav.sixth.e3d.gui; -import eu.svjatoslav.sixth.e3d.geometry.GeometryCoordinate; +import eu.svjatoslav.sixth.e3d.math.GeometryCoordinate; import eu.svjatoslav.sixth.e3d.geometry.Point3D; -import eu.svjatoslav.sixth.e3d.geometry.TransformPipe; +import eu.svjatoslav.sixth.e3d.math.TransformPipe; public class UserRelativityTracker { - public final static int minimalSliceFactor = 5; + private final static int minimalSliceFactor = 5; public GeometryCoordinate center = new GeometryCoordinate(); public GeometryCoordinate right; public GeometryCoordinate down; @@ -57,8 +57,7 @@ public class UserRelativityTracker { } public double getDistanceToUser() { - return center.transformedCoordinate - .getDistanceTo(Point3D.ZERO); + return center.transformedCoordinate.getVectorLength(); } public double proposeSliceFactor() { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/View.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/View.java index 6f1b474..615c69b 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/View.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/View.java @@ -23,7 +23,7 @@ public class View extends JPanel implements ComponentListener { private static final long serialVersionUID = 1683277888885045387L; private final List viewListeners = new ArrayList<>(); - private final List viewUpdateListeners = new ArrayList<>(); + private final List viewRenderListeners = new ArrayList<>(); private final ViewContext context = new ViewContext(this); /** * Last time this view was updated @@ -40,11 +40,11 @@ public class View extends JPanel implements ComponentListener { private boolean repaintDuringNextViewUpdate = true; public View() { - viewUpdateListeners.add(context.getAvatar()); + viewRenderListeners.add(context.getAvatar()); // initialize input tracker context.getUserInputTracker().bind(this); - viewUpdateListeners.add(context.getUserInputTracker()); + viewRenderListeners.add(context.getUserInputTracker()); initializePanelLayout(); @@ -57,8 +57,8 @@ public class View extends JPanel implements ComponentListener { getViewListeners().add(listener); } - public void addViewUpdateListener(final ViewUpdateListener listener) { - viewUpdateListeners.add(listener); + public void addViewUpdateListener(final ViewRenderListener listener) { + viewRenderListeners.add(listener); } @Override @@ -237,8 +237,8 @@ public class View extends JPanel implements ComponentListener { // notify update listeners boolean reRenderFrame = false; - for (final ViewUpdateListener listener : viewUpdateListeners) - if (listener.beforeViewUpdate(context, + for (final ViewRenderListener listener : viewRenderListeners) + if (listener.beforeRender(context, millisecondsPassedSinceLastUpdate)) reRenderFrame = true; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java new file mode 100644 index 0000000..0977ef7 --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java @@ -0,0 +1,27 @@ +/* + * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. + * + */ + +package eu.svjatoslav.sixth.e3d.gui; + +public interface ViewRenderListener { + + /** + * Notifies that it is about time to render next frame and + * allows listener to do any related processing that it needs to. + * + * Each {@link ViewRenderListener} will be notified exactly once before every frame is rendered. + * + * {@link ViewRenderListener} can determine if frame repaint is actually + * needed from its perspective. Frame will be rendered only if at least one listener says yes. + * + * @return true if underlying view shall be re-rendered. If at least one of the view update listeners + * returns true, view is re-rendered. + */ + boolean beforeRender(ViewContext viewContext, final int millisecondsSinceLastFrame); +} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateListener.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateListener.java deleted file mode 100644 index 41a51f9..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateListener.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.gui; - -public interface ViewUpdateListener { - - /** - * Notifies that it is about time to render next frame. Update listener can determine if frame repaint is actually - * needed from its perspective. Frame will be rendered if at least one listener says yes. - * - * @return true if underlying view shall be re-rendered. If at least one of the view update listeners - * returns true, view is re-rendered. - */ - boolean beforeViewUpdate(ViewContext viewContext, final int millisecondsSinceLastFrame); -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java index e763a8e..ae9f8d9 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java @@ -10,11 +10,11 @@ package eu.svjatoslav.sixth.e3d.gui.humaninput; import eu.svjatoslav.sixth.e3d.gui.ViewContext; -import eu.svjatoslav.sixth.e3d.gui.ViewUpdateListener; +import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener; import java.awt.event.KeyEvent; -public interface UserInputHandler extends ViewUpdateListener { +public interface UserInputHandler extends ViewRenderListener { void focusLost(ViewContext viewContext); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputTracker.java index dedfd78..105a582 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputTracker.java @@ -13,7 +13,7 @@ import eu.svjatoslav.sixth.e3d.geometry.Point2D; import eu.svjatoslav.sixth.e3d.gui.Avatar; import eu.svjatoslav.sixth.e3d.gui.View; import eu.svjatoslav.sixth.e3d.gui.ViewContext; -import eu.svjatoslav.sixth.e3d.gui.ViewUpdateListener; +import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener; import javax.swing.*; import java.awt.event.*; @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; public class UserInputTracker - implements MouseMotionListener, KeyListener, MouseListener, MouseWheelListener, ViewUpdateListener { + implements MouseMotionListener, KeyListener, MouseListener, MouseWheelListener, ViewRenderListener { /** *
@@ -36,12 +36,12 @@ public class UserInputTracker
     private final Map pressedKeysToPressedTimeMap = new HashMap<>();
     private final List detectedMouseClicks = new ArrayList<>();
     private final List detectedKeyEvents = new ArrayList<>();
-    public int wheelMovedDirection = 0;
-    Point2D mouseDraggedDirection = new Point2D();
-    Point2D oldMouseCoordinatesWhenDragging;
-    ViewContext viewContext;
-    Point2D currentMouseLocation;
-    boolean mouseMoved;
+    private int wheelMovedDirection = 0;
+    private Point2D mouseDraggedDirection = new Point2D();
+    private Point2D oldMouseCoordinatesWhenDragging;
+    private ViewContext viewContext;
+    private Point2D currentMouseLocation;
+    private boolean mouseMoved;
     private boolean mouseWithinWindow = false;
 
     public UserInputTracker(final ViewContext viewContext) {
@@ -52,14 +52,15 @@ public class UserInputTracker
      * {@inheritDoc}
      */
     @Override
-    public boolean beforeViewUpdate(final ViewContext viewContext, final int millisecondsSinceLastFrame) {
+    public boolean beforeRender(final ViewContext viewContext, final int millisecondsSinceLastFrame) {
 
         boolean viewUpdateNeeded = handleDetectedMouseClicks(viewContext.getView());
 
         viewUpdateNeeded |= handleDetectedKeyEvents();
 
-        viewContext.getKeyboardFocusTracker().getCurrentFocusOwner().beforeViewUpdate(viewContext,
+        viewContext.getKeyboardFocusTracker().getCurrentFocusOwner().beforeRender(viewContext,
                 millisecondsSinceLastFrame);
+
         viewUpdateNeeded |= trackMouse();
 
         return viewUpdateNeeded;
@@ -75,7 +76,7 @@ public class UserInputTracker
         panel.addMouseWheelListener(this);
     }
 
-    public boolean handleDetectedKeyEvents() {
+    private boolean handleDetectedKeyEvents() {
         boolean keyEventsHandled = false;
 
         final UserInputHandler currentFocusOwner = viewContext.getKeyboardFocusTracker().getCurrentFocusOwner();
@@ -107,10 +108,9 @@ public class UserInputTracker
     }
 
     /**
-     * Returns true if mouse events are detected and view needs to
-     * be repainted.
+     * @return true if view needs to be repainted.
      */
-    public synchronized boolean handleDetectedMouseClicks(final View view) {
+    private synchronized boolean handleDetectedMouseClicks(final View view) {
         if (detectedMouseClicks.isEmpty()) {
 
             if (currentMouseLocation != null)
@@ -128,7 +128,7 @@ public class UserInputTracker
         return true;
     }
 
-    public boolean isKeyPressed(final int keyCode) {
+    boolean isKeyPressed(final int keyCode) {
         return pressedKeysToPressedTimeMap.containsKey(keyCode);
     }
 
@@ -209,11 +209,27 @@ public class UserInputTracker
     /**
      * Interpret mouse movement
      */
-    public boolean trackMouse() {
+    private boolean trackMouse() {
         final Avatar avatar = viewContext.getAvatar();
+        trackDragging(avatar);
+        trackVerticalScrolling(avatar);
+
+        boolean repaintNeeded = !mouseDraggedDirection.isZero() || (wheelMovedDirection != 0);
 
-        // track mouse dragging
+        // reset movement counters
+        wheelMovedDirection = 0;
+        mouseDraggedDirection.zero();
+
+        return repaintNeeded;
+    }
+
+    private void trackVerticalScrolling(Avatar avatar) {
+        final double actualAcceleration = 50 * avatar.avatarAcceleration * (1 + (avatar.getMovementSpeed() / 10));
+        avatar.getMovementVector().y += (wheelMovedDirection * actualAcceleration);
+        avatar.enforceSpeedLimit();
+    }
 
+    private void trackDragging(Avatar avatar) {
         // TODO: need to detect whether user moved mouse or touch screen
 
         // for mouse
@@ -225,22 +241,6 @@ public class UserInputTracker
         // mouseDraggedDirection.x / 50));
         // avatar.setAngleYZ(avatar.getAngleYZ() + ((float)
         // mouseDraggedDirection.y / 50));
-
-        // track mouse wheel movements
-        final double actualAcceleration = 50 * avatar.avatarAcceleration * (1 + (avatar.getMovementSpeed() / 10));
-
-        avatar.getMovementVector().y += (wheelMovedDirection * actualAcceleration);
-        avatar.enforceSpeedLimit();
-
-        // check if view shall be repainted
-        boolean repaintNeeded;
-        repaintNeeded = (mouseDraggedDirection.x != 0) || (mouseDraggedDirection.y != 0) || (wheelMovedDirection != 0);
-
-        // reset movement counters
-        wheelMovedDirection = 0;
-        mouseDraggedDirection.zero();
-
-        return repaintNeeded;
     }
 
 }
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java
index 59066a8..cc99c42 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationTracker.java
@@ -18,8 +18,8 @@ import java.awt.event.KeyEvent;
 public class WorldNavigationTracker implements UserInputHandler {
 
     @Override
-    public boolean beforeViewUpdate(final ViewContext viewContext,
-                                    final int millisecondsSinceLastFrame) {
+    public boolean beforeRender(final ViewContext viewContext,
+                                final int millisecondsSinceLastFrame) {
 
         trackKeys(millisecondsSinceLastFrame, viewContext);
         return false;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java
index 4db49d5..b7c633f 100755
--- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java
@@ -10,7 +10,7 @@
 package eu.svjatoslav.sixth.e3d.gui.textEditorComponent;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.GuiComponent;
 import eu.svjatoslav.sixth.e3d.gui.TextPointer;
 import eu.svjatoslav.sixth.e3d.gui.ViewContext;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java
new file mode 100644
index 0000000..d95717c
--- /dev/null
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java
@@ -0,0 +1,51 @@
+/*
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ *
+ */
+
+package eu.svjatoslav.sixth.e3d.math;
+
+import eu.svjatoslav.sixth.e3d.geometry.Point2D;
+import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
+
+public class GeometryCoordinate {
+
+    public Point3D coordinate;
+    public Point3D transformedCoordinate;
+    public Point2D onScreenCoordinate;
+
+    private int lastTransformedFrame;
+
+    public GeometryCoordinate() {
+        coordinate = new Point3D();
+        transformedCoordinate = new Point3D();
+        onScreenCoordinate = new Point2D();
+    }
+
+    public GeometryCoordinate(final Point3D location) {
+        coordinate = location;
+        transformedCoordinate = new Point3D();
+        onScreenCoordinate = new Point2D();
+    }
+
+    public void transform(final TransformPipe transforms,
+                          final RenderingContext renderContext) {
+
+        if (lastTransformedFrame == renderContext.frameNumber)
+            return;
+
+        lastTransformedFrame = renderContext.frameNumber;
+
+        transforms.transform(coordinate, transformedCoordinate);
+
+        onScreenCoordinate.x = ((transformedCoordinate.x / transformedCoordinate.z) * renderContext.zoom)
+                + renderContext.xCenter;
+        onScreenCoordinate.y = ((transformedCoordinate.y / transformedCoordinate.z) * renderContext.zoom)
+                + renderContext.yCenter;
+    }
+}
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
new file mode 100644
index 0000000..958286a
--- /dev/null
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
@@ -0,0 +1,59 @@
+/*
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ *
+ */
+
+
+package eu.svjatoslav.sixth.e3d.math;
+
+import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+
+public class Orientation implements Cloneable {
+
+    private double s1, c1, s2, c2;
+
+    private double angleXZ = 0;
+    private double angleYZ = 0;
+
+    public Orientation() {
+        computeMultipliers();
+    }
+
+    public Orientation(final double angleXZ, final double angleYZ) {
+        this.angleXZ = angleXZ;
+        this.angleYZ = angleYZ;
+        computeMultipliers();
+    }
+
+    @Override
+    public Orientation clone() {
+        return new Orientation(angleXZ, angleYZ);
+    }
+
+    private void computeMultipliers() {
+        s1 = Math.sin(angleXZ);
+        c1 = Math.cos(angleXZ);
+
+        s2 = Math.sin(angleYZ);
+        c2 = Math.cos(angleYZ);
+    }
+
+    public void rotate(final Point3D point3d) {
+        final double z1 = (point3d.z * c1) - (point3d.x * s1);
+        point3d.x = (point3d.z * s1) + (point3d.x * c1);
+
+        point3d.z = (z1 * c2) - (point3d.y * s2);
+        point3d.y = (z1 * s2) + (point3d.y * c2);
+    }
+
+    public void rotate(final double angleXZ, final double angleYZ) {
+        this.angleXZ += angleXZ;
+        this.angleYZ += angleYZ;
+        computeMultipliers();
+    }
+
+}
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
new file mode 100755
index 0000000..059ba39
--- /dev/null
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
@@ -0,0 +1,59 @@
+/*
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ *
+ */
+
+package eu.svjatoslav.sixth.e3d.math;
+
+import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+
+public class Transform implements Cloneable {
+
+    private final Point3D translation;
+    private final Orientation orientation;
+
+    public Transform() {
+        translation = new Point3D();
+        orientation = new Orientation();
+    }
+
+    public Transform(final Point3D translation) {
+        this.translation = translation;
+        orientation = new Orientation();
+    }
+
+    public Transform(final Point3D translation, final double angleXZ,
+                     final double angleYZ) {
+
+        this.translation = translation;
+        orientation = new Orientation(angleXZ, angleYZ);
+    }
+
+    public Transform(final Point3D translation, final Orientation orientation) {
+        this.translation = translation;
+        this.orientation = orientation;
+    }
+
+    @Override
+    public Transform clone() {
+        return new Transform(translation, orientation);
+    }
+
+    public Orientation getOrientation() {
+        return orientation;
+    }
+
+    public Point3D getTranslation() {
+        return translation;
+    }
+
+    public void transform(final Point3D point) {
+        orientation.rotate(point);
+        point.add(translation);
+    }
+
+}
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java
new file mode 100644
index 0000000..b554953
--- /dev/null
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java
@@ -0,0 +1,40 @@
+/*
+ * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ *
+ */
+
+package eu.svjatoslav.sixth.e3d.math;
+
+import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+
+public class TransformPipe {
+
+    private Transform[] transforms = new Transform[100];
+
+    private int transformsCount = 0;
+
+    public void addTransform(final Transform transform) {
+        transforms[transformsCount] = transform;
+        transformsCount++;
+    }
+
+    public void clear() {
+        transformsCount = 0;
+    }
+
+    public void dropTransform() {
+        transformsCount--;
+    }
+
+    public void transform(final Point3D source, final Point3D destination) {
+
+        destination.clone(source);
+
+        for (int i = transformsCount - 1; i >= 0; i--)
+            transforms[i].transform(destination);
+    }
+}
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java
index 02e2502..e4dd649 100755
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java
@@ -10,7 +10,7 @@
 package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.Avatar;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
@@ -58,7 +58,7 @@ public class Camera extends TexturedRectangle {
     private void computeCameraCoordinates(final Avatar avatar) {
         initialize(CAMERA_SIZE, CAMERA_SIZE, IMAGE_SIZE, IMAGE_SIZE, 3);
 
-        camCenter = Point3D.ZERO.clone();
+        camCenter = new Point3D();
 
         topLeft.setValues(camCenter.x, camCenter.y, camCenter.z + CAMERA_SIZE);
 
@@ -75,10 +75,8 @@ public class Camera extends TexturedRectangle {
 
         topLeft.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
         topRight.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
-        bottomLeft
-                .rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
-        bottomRight.rotate(camCenter, -avatar.getAngleXZ(),
-                -avatar.getAngleYZ());
+        bottomLeft.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
+        bottomRight.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
 
         final Color cameraColor = new Color(255, 255, 0, 255);
         final LineAppearance appearance = new LineAppearance(2, cameraColor);
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java
index b453f74..2faf880 100755
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java
@@ -10,8 +10,8 @@
 package eu.svjatoslav.sixth.e3d.renderer.raster;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
+import eu.svjatoslav.sixth.e3d.math.Transform;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
 import eu.svjatoslav.sixth.e3d.gui.Avatar;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.gui.ViewContext;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
index ed5c364..97ffc7b 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
@@ -9,9 +9,9 @@
 
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes;
 
-import eu.svjatoslav.sixth.e3d.geometry.GeometryCoordinate;
+import eu.svjatoslav.sixth.e3d.math.GeometryCoordinate;
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.renderer.raster.RenderAggregator;
 
@@ -60,7 +60,7 @@ public abstract class AbstractCoordinateShape extends AbstractShape {
 
             accumulatedZ += geometryPoint.transformedCoordinate.z;
 
-            if (!geometryPoint.transformedCoordinate.withinDrawingLimits())
+            if (!geometryPoint.transformedCoordinate.isVisible())
                 paint = false;
         }
 
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
index 6aeb2eb..c33ceb7 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
@@ -9,7 +9,7 @@
 
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes;
 
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController;
 import eu.svjatoslav.sixth.e3d.renderer.raster.RenderAggregator;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
index 24bd64e..5a77288 100755
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
@@ -10,7 +10,7 @@
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.GlowingPoint;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
index cc68fc3..674c1e3 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
@@ -11,7 +11,7 @@ package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.Line;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
index 183fe79..ea23bfc 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
@@ -11,7 +11,7 @@ package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.texturedpolygon.TexturedPolygon;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
 import eu.svjatoslav.sixth.e3d.renderer.raster.texture.Texture;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
index d9586ab..7d2ae4c 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
@@ -10,8 +10,8 @@
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
+import eu.svjatoslav.sixth.e3d.math.Transform;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.gui.UserRelativityTracker;
 import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
index 3f1f88b..956cf2c 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
@@ -10,8 +10,8 @@
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
-import eu.svjatoslav.sixth.e3d.geometry.TransformPipe;
+import eu.svjatoslav.sixth.e3d.math.Transform;
+import eu.svjatoslav.sixth.e3d.math.TransformPipe;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.gui.TextPointer;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
index 6136e91..0156db2 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
@@ -11,7 +11,7 @@ package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
 import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
-import eu.svjatoslav.sixth.e3d.geometry.Transform;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
 
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
index 05c9a4a..2d4c661 100644
--- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
+++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
@@ -38,7 +38,7 @@ public class BorderLine implements Comparator {
 
     public PolygonCoordinate getMiddlePoint() {
         return new PolygonCoordinate(new Point3D().computeMiddlePoint(c1.space,
-                c2.space), new Point2D().computeMiddlePoint(c1.texture,
+                c2.space), new Point2D().getMiddle(c1.texture,
                 c2.texture));
     }
 }