Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float pronadjiNajveciOpseg(Trokut* trokuti, int m){
- float max, t;
- for (int i = 0; i < m; i++)
- {
- t = len3d(trokuti[i].t1->x, trokuti[i].t1->y, trokuti[i].t1->z, trokuti[i].t2->x, trokuti[i].t2->y, trokuti[i].t2->z, trokuti[i].t3->x, trokuti[i].t3->y, trokuti[i].t3->z);
- if (t > max)
- {
- max = t;
- }
- }
- }
- float len3d(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) {
- float d = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) + pow(z2 - z1, 2));
- d += sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2) + pow(z3 - z2, 2));
- d += sqrt(pow(x1 - x3, 2) + pow(y1 - y3, 2) + pow(z1 - z3, 2));
- return d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement