Advertisement
Guest User

type-bound test

a guest
May 29th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module triangles
  2. implicit none
  3. type, public :: triangle
  4.     private
  5.     real, dimension(3):: x,y
  6.     real :: centerX, centerY
  7. contains
  8.     procedure::rotate
  9.     generic::operator(.rotate.)=>rotate
  10. end type
  11. contains
  12.  
  13. function rotate(a,b) result (c)
  14. class(triangle), intent(in)::a
  15. class(triangle), allocatable::c
  16. real, intent(in)::b
  17. c.x=a.x*cos(b)+a.y*sin(b)
  18. c.y=-a.x*sin(b)+a.y*cos(b)
  19. end function rotate
  20.  
  21. end module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement