44 real(kind=
dp),
dimension(3) :: x
79 real(kind=
dp),
dimension(3),
intent(in) :: x
80 integer,
optional,
intent(inout) :: id
95 real(kind=
dp),
intent(in) :: x
96 real(kind=
dp),
intent(in) :: y
97 real(kind=
dp),
intent(in) :: z
98 integer,
optional,
intent(inout) :: id
101 if (
present(id))
then
115 class(
point_t),
intent(inout) :: this
116 real(kind=
dp),
dimension(3),
intent(in) :: x
125 class(
point_t),
intent(in) :: p1
126 class(
point_t),
intent(in) :: p2
129 if (
abscmp(p1%x(1), p2%x(1)) .and. &
130 abscmp(p1%x(2), p2%x(2)) .and. &
131 abscmp(p1%x(3), p2%x(3)))
then
142 class(
point_t),
intent(in) :: p1
143 class(
point_t),
intent(in) :: p2
146 if (.not.
abscmp(p1%x(1), p2%x(1)) .or. &
147 .not.
abscmp(p1%x(2), p2%x(2)) .or. &
148 .not.
abscmp(p1%x(3), p2%x(3)))
then
159 class(
point_t),
intent(in) :: p1
160 class(
point_t),
intent(in) :: p2
163 if (p1%x(1) .lt. p2%x(1) .or. &
164 (
abscmp(p1%x(1), p2%x(1)) .and. &
165 (p1%x(2) .lt. p2%x(2) .or. &
166 (
abscmp(p1%x(2), p2%x(2)) .and. p1%x(3) .lt. p2%x(3)))))
then
177 class(
point_t),
intent(in) :: p1
178 class(
point_t),
intent(in) :: p2
191 class(
point_t),
intent(in) :: p1
192 class(
point_t),
intent(in) :: p2
195 res%x(1) = p1%x(1) + p2%x(1)
196 res%x(2) = p1%x(2) + p2%x(2)
197 res%x(3) = p1%x(3) + p2%x(3)
203 class(
point_t),
intent(in) :: p1
204 class(
point_t),
intent(in) :: p2
207 res%x(1) = p1%x(1) - p2%x(1)
208 res%x(2) = p1%x(2) - p2%x(2)
209 res%x(3) = p1%x(3) - p2%x(3)
215 class(
point_t),
intent(in) :: p
216 real(kind=
rp),
intent(in) :: a
219 res%x(1) = a * p%x(1)
220 res%x(2) = a * p%x(2)
221 res%x(3) = a * p%x(3)
227 class(
point_t),
intent(in) :: p1
228 type(
point_t),
intent(in) :: p2
231 res = sqrt( (p1%x(1) - p2%x(1))**2 &
232 + (p1%x(2) - p2%x(2))**2 &
233 + (p1%x(3) - p2%x(3))**2 )
238 class(
point_t),
intent(in) :: x
239 real(kind=
rp),
intent(in) :: a(3,3)
247 b%x(i) = b%x(i) + a(i,j) * x%x(j)
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
type(point_t) function point_init(x, id)
Initialize a point from an array x of coordinates.
pure logical function point_gt(p1, p2)
Check if .
pure logical function point_eq(p1, p2)
Check if .
type(point_t) function point_subtract(p1, p2)
Returns the subtraction of 2 points .
type(point_t) function point_mat_mult(a, x)
Computes matrix-vector product in : .
type(point_t) function point_init_xyz(x, y, z, id)
Initialize a point from coordinates.
subroutine point_assign(this, x)
Assigns coordinates x to a point.
type(point_t) function point_scalar_mult(p, a)
Returns the multiplication of a point by a scalar .
pure logical function point_lt(p1, p2)
Check if .
pure real(kind=rp) function point_euclid_dist(p1, p2)
Returns the Euclidean distance between two points .
type(point_t) function point_add(p1, p2)
Returns the addition of 2 points .
pure logical function point_ne(p1, p2)
Check if .
Defines a pointer to a point type.
A point in with coordinates .