CoMidpoint(x1, y1, x2, y2)
Last updated July 17, 2001
Version: 1 | Requires: CF5 | Library: MathLib
Description:
Returns the coordinates of the midpoint between two points on a line on the Cartesian coordinate system.
Return Values:
Returns a string
Example:
<CFSET x1=1>
<CFSET y1=5>
<CFSET x2=1>
<CFSET y2=-5>
<CFOUTPUT>
Given:
<UL>
<LI>x1,y1 = (1,5)
<LI>x2,y2 = (1,-5)
</UL>
The midpoint between (#x1#,#y1#) and (#x2#,#y2#) = (#CoMidpoint(x1,y1,x2,y2)#)
</CFOUTPUT>
Parameters:
Name | Description | Required |
---|---|---|
x1 | x position of the first point | Yes |
y1 | y position of the first point | Yes |
x2 | x position of the second point | Yes |
y2 | y position of the second point | Yes |
Full UDF Source:
/**
* Returns the coordinates of the midpoint between two points on a line.
*
* @param x1 x position of the first point
* @param y1 y position of the first point
* @param x2 x position of the second point
* @param y2 y position of the second point
* @return Returns a string
* @author Rob Brooks-Bilson (rbils@amkor.com)
* @version 1.0, July 17, 2001
*/
function CoMidpoint(x1,y1,x2,y2)
{
Return (x1+x2)/2 & ',' & (y1+y2)/2;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016