this question has been asked to death. i've read all the answers and i still can't get my head around it after 2 days! all my syntax will be in programming code as i find it easier to follow than anything else and that's what i'll be using it with anyway.
i need the equation for calculating the reflection of point ($tx, $ty) over line ($rx1, $ry1 -> $rx2, $ry2). i'll call the point that i want to calculate ($zx, $zy)
i have the equation of the line, i think...
$slope = (($ry2 - $ry1) / ($rx2 - $rx1));
$yintercept = ($ry1 - ($slope * $rx1));
$zy = ($slope * $zx) + $yintercept;
i'm having trouble with the rest. i understand the perpendicular is next to calculate but after that is too much for me to take in. you could explain it to me for a week and i still wouldn't get it so if someone could please write it out in a way i can understand / use, that would be great, i can get on with my project then.
here's an example of how i intend the finished equation to look (except this is for calculating line intersection, not symmetry)
$interceptX = ((((($startX * $targetY) - ($startY * $targetX)) * ($rx1 - $rx1)) - (($startX - $targetX) * (($rx1 * $ry1) - ($ry1 * $rx1)))) / ((($startX - $targetX) * ($ry1 - $ry1)) - (($startY - $targetY) * ($rx1 - $rx1))));
$interceptY = ((((($startX * $targetY) - ($startY * $targetX)) * ($ry1 - $ry1)) - (($startY - $targetY) * (($rx1 * $ry1) - ($ry1 * $rx1)))) / ((($startX - $targetX) * ($ry1 - $ry1)) - (($startY - $targetY) * ($rx1 - $rx1))));
thanks.
i need the equation for calculating the reflection of point ($tx, $ty) over line ($rx1, $ry1 -> $rx2, $ry2). i'll call the point that i want to calculate ($zx, $zy)
i have the equation of the line, i think...
$slope = (($ry2 - $ry1) / ($rx2 - $rx1));
$yintercept = ($ry1 - ($slope * $rx1));
$zy = ($slope * $zx) + $yintercept;
i'm having trouble with the rest. i understand the perpendicular is next to calculate but after that is too much for me to take in. you could explain it to me for a week and i still wouldn't get it so if someone could please write it out in a way i can understand / use, that would be great, i can get on with my project then.
here's an example of how i intend the finished equation to look (except this is for calculating line intersection, not symmetry)
$interceptX = ((((($startX * $targetY) - ($startY * $targetX)) * ($rx1 - $rx1)) - (($startX - $targetX) * (($rx1 * $ry1) - ($ry1 * $rx1)))) / ((($startX - $targetX) * ($ry1 - $ry1)) - (($startY - $targetY) * ($rx1 - $rx1))));
$interceptY = ((((($startX * $targetY) - ($startY * $targetX)) * ($ry1 - $ry1)) - (($startY - $targetY) * (($rx1 * $ry1) - ($ry1 * $rx1)))) / ((($startX - $targetX) * ($ry1 - $ry1)) - (($startY - $targetY) * ($rx1 - $rx1))));
thanks.