fork download
  1. def LocGeomH():
  2.  
  3. def ortocentru(zA, zB, zC):
  4. a = C.rho(zB - zC)
  5. b = C.rho(zA - zC)
  6. c = C.rho(zB - zA)
  7.  
  8. alph = (a ** 2) * ((b ** 2) + (c ** 2) - (a ** 2))
  9. beth = (b ** 2) * ((a ** 2) + (c ** 2) - (b ** 2))
  10. gamm = (c ** 2) * ((a ** 2) + (b ** 2) - (c ** 2))
  11. zH = (alph*zA+beth*zB+gamm*zC)/(alph+beth+gamm)
  12. return zH
  13.  
  14. C.setXminXmaxYminYmax(-10, 10, -12, 8)
  15. q = 0
  16. R = 6
  17. nrPuncte = 720
  18. delta = 2 * math.pi / nrPuncte
  19. nB = nrPuncte // 2 + nrPuncte // 15
  20. nC = nrPuncte - nrPuncte // 15
  21. zB = C.fromRhoTheta(R, nB * delta)
  22. zC = C.fromRhoTheta(R, nC * delta)
  23.  
  24. lista=[]#
  25. listasim=[]
  26.  
  27. for n in range(10 * nrPuncte):
  28. if n % nrPuncte == nB or n % nrPuncte == nC:
  29. continue
  30. C.fillScreen(Color.White)
  31. C.setNgon(unCercQR(q, R, nrPuncte), Color.Navy)
  32. zA = C.fromRhoTheta(R, n * delta)
  33. C.drawNgon([zA, zB, zC], Color.Navy)
  34. zH = ortocentru(zA, zB, zC)
  35. lista.append(zH)
  36. listasim.append(zH*(-1))
  37. C.drawNgon([zA, zH, zB, zH, zC, zH], Color.Green)
  38. for i in lista:
  39. C.setPixel(i,Color.Red)
  40. for i in listasim:
  41. C.setPixel(i,Color.Red)
  42.  
  43. if C.mustClose():
  44. return
Success #stdin #stdout 0.02s 7040KB
stdin
Standard input is empty
stdout
Standard output is empty