Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. float pronadjiNajveciOpseg(Trokut* trokuti, int m){
  2. float max, t;
  3. for (int i = 0; i < m; i++)
  4. {
  5. 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);
  6. if (t > max)
  7. {
  8. max = t;
  9. }
  10. }
  11. }
  12. float len3d(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) {
  13. float d = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) + pow(z2 - z1, 2));
  14. d += sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2) + pow(z3 - z2, 2));
  15. d += sqrt(pow(x1 - x3, 2) + pow(y1 - y3, 2) + pow(z1 - z3, 2));
  16. return d;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement