Here you can find the source of distance(double u, double v, double pu, double pv)
Parameter | Description |
---|---|
u | u coordinate of point u,v |
v | v coordinate of point u,v |
pu | pu coordinate of point pu,pv |
pv | pv coordinate of point pu,pv |
public static double distance(double u, double v, double pu, double pv)
//package com.java2s; /*//from w ww . j ava 2 s .c om * Texture Generator Library by Andy Gibson * * This software is distributed under the terms of the FSF Lesser * Gnu Public License. It is provided as-is, without any express * or implied warranty, or guarantee of any kind. * */ public class Main { /** * Returns the distance from point u,v to point pu,pv * * @param u * u coordinate of point u,v * @param v * v coordinate of point u,v * @param pu * pu coordinate of point pu,pv * @param pv * pv coordinate of point pu,pv * @return The distance from one point to the other using Pythagoras */ public static double distance(double u, double v, double pu, double pv) { double du = pu - u; double dv = pv - v; dv = dv * dv; du = du * du; return Math.sqrt(dv + du); } }