Here you can find the source of interpol(Point p1, Point p2, float factor)
Parameter | Description |
---|---|
p1 | a parameter |
p2 | a parameter |
factor | a parameter |
private static Point interpol(Point p1, Point p2, float factor)
//package com.java2s; //License from project: Open Source License import java.awt.Point; public class Main { /**// w w w . ja va2 s .co m * makes a curvic interpolation between points * * @param p1 * @param p2 * @param factor * @return */ private static Point interpol(Point p1, Point p2, float factor) { Point p = new Point((int) (p1.x * (1 - factor) + p2.x * factor), (int) (p1.y * (1 - factor) + p2.y * factor)); int targety = factor <= 0.5 ? p1.y : p2.y; float facy = Math.abs(factor - 0.5f) * 2; p.y = (int) (targety * facy + p.y * (1 - facy)); return p; } }