/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "vector.h" float vectorDistance2D(float x0, float y0, float x1, float y1) { x0 = x1 - x0; y0 = y1 - y0; return (float)sqrt(x0*x0 + y0*y0); } float vectorDistance3D( float x0, float y0, float z0, float x1, float y1, float z1 ) { x0 = x1 - x0; y0 = y1 - y0; z0 = z1 - z0; return (float)sqrt(x0*x0 + y0*y0 + z0*z0); }