Tuesday, August 30, 2011

Fruit Distance Two Points

The distance between point A (x1, y1) and point B (x2, y2)
AB = Ö ((x1-x2) ² + (y1-y2) ²)
Coordinates Midpoint
Coordinates of the midpoint between point A (x1, y2) and point B (x2, y2)
XT = (x1 + x2) / 2
YT = (y1 + y2) / 2
Distance point to line
Distance of point A (x1, y1) to the line
g: ax + by + c = 0
d = | (ax1 + by1 + c) / Ö (a ² + b ²) |

Note:

To determine the distance between two parallel lines, first specify any point that lies on one line, then declare this point distances to the other line.

Or use the formula to be:

The distance of two parallel lines ax + by + c1 = 0 and ax + by + c2 = 0 is

d = | (c1-c2) / Ö (a ² + b ²) |

usage: (....)
Area of ​​triangle = ½ (base X height)
(base = distance of 2 points; height = distance point to line
Area of ​​square = side x side
(side = distance of 2 points or distance point to line
Area of ​​Trapezoid = ½ (sum of parallel sides x height)
(parallel side = distance of 2 points; height = distance point to line)


program's source code distance of two points :

#pragma argsused
#include <iostream.h>

  class DISTANCE {
     private:
      float x1, x2, y1, y2;
      double result, a, b;
     public:
       void titik(){
         cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
         cout<<"\t\t|the program calculates the distance of two points|"<<endl;
         cout<<"\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
         cout<<"enter the value x1 :";
         cin>>x1;
         cout<<"enter the value x2 :";
         cin>>x2;
         cout<<"enter the value y1 :";
         cin>>y1;
         cout<<"enter the value y2 :";
         cin>>y2;

         a = (x1-x2) * (x1-x2);
         b = (y1-y2) * (y1-y2);
         hasil = a + b;
         cout<<"the distance of two points is :"<<result<<endl;
       }
     };
int main(){
    int x;
     DISTANCE J;
     J.point();
    cin>>x;

        return 0;
}


good luck...!!!



source : http://bebas.ui.ac.id/v12/sponsor/Sponsor-Pendamping/Praweda/Matematika/0383%20Mat%201-5f.htm 

0 comments:

Template by : wanto arwan-programing.blogspot.com