Package de.fhpotsdam.unfolding.geo

Source Code of de.fhpotsdam.unfolding.geo.Transformation

package de.fhpotsdam.unfolding.geo;

import processing.core.PVector;

public class Transformation {

  public double ax, bx, cx, ay, by, cy;

  public Transformation(double ax, double bx, double cx, double ay, double by, double cy) {
    this.ax = ax;
    this.bx = bx;
    this.cx = cx;
    this.ay = ay;
    this.by = by;
    this.cy = cy;
  }

  public PVector transform(PVector point) {
    return new PVector((float) (ax * point.x + bx * point.y + cx), (float) (ay * point.x + by * point.y + cy));
  }

  public PVector untransform(PVector point) {
    return new PVector((float) ((point.x * by - point.y * bx - cx * by + cy * bx) / (ax * by - ay * bx)),
        (float) ((point.x * ay - point.y * ax - cx * ay + cy * ax) / (bx * ay - by * ax)));
  }

TOP

Related Classes of de.fhpotsdam.unfolding.geo.Transformation

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.