geo_types/geometry/point.rs
1use crate::{point, Coord, CoordFloat, CoordNum};
2
3use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
4
5/// A single point in 2D space.
6///
7/// Points can be created using the [`Point::new`] constructor,
8/// the [`point!`] macro, or from a `Coord`, two-element
9/// tuples, or arrays – see the `From` impl section for a
10/// complete list.
11///
12/// # Semantics
13///
14/// The _interior_ of the point is itself (a singleton set),
15/// and its _boundary_ is empty. A point is _valid_ if and
16/// only if the `Coord` is valid.
17///
18/// # Examples
19///
20/// ```
21/// use geo_types::{coord, Point};
22/// let p1: Point = (0., 1.).into();
23/// let c = coord! { x: 10., y: 20. };
24/// let p2: Point = c.into();
25/// ```
26#[derive(Eq, PartialEq, Clone, Copy, Hash, Default)]
27#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
28pub struct Point<T: CoordNum = f64>(pub Coord<T>);
29
30impl<T: CoordNum> From<Coord<T>> for Point<T> {
31 fn from(x: Coord<T>) -> Self {
32 Point(x)
33 }
34}
35
36impl<T: CoordNum> From<(T, T)> for Point<T> {
37 fn from(coords: (T, T)) -> Self {
38 Point::new(coords.0, coords.1)
39 }
40}
41
42impl<T: CoordNum> From<[T; 2]> for Point<T> {
43 fn from(coords: [T; 2]) -> Self {
44 Point::new(coords[0], coords[1])
45 }
46}
47
48impl<T: CoordNum> From<Point<T>> for (T, T) {
49 fn from(point: Point<T>) -> Self {
50 point.0.into()
51 }
52}
53
54impl<T: CoordNum> From<Point<T>> for [T; 2] {
55 fn from(point: Point<T>) -> Self {
56 point.0.into()
57 }
58}
59
60impl<T: CoordNum> Point<T> {
61 /// Creates a new point.
62 ///
63 /// # Examples
64 ///
65 /// ```
66 /// use geo_types::Point;
67 ///
68 /// let p = Point::new(1.234, 2.345);
69 ///
70 /// assert_eq!(p.x(), 1.234);
71 /// assert_eq!(p.y(), 2.345);
72 /// ```
73 pub fn new(x: T, y: T) -> Self {
74 point! { x: x, y: y }
75 }
76
77 /// Returns the x/horizontal component of the point.
78 ///
79 /// # Examples
80 ///
81 /// ```
82 /// use geo_types::Point;
83 ///
84 /// let p = Point::new(1.234, 2.345);
85 ///
86 /// assert_eq!(p.x(), 1.234);
87 /// ```
88 pub fn x(self) -> T {
89 self.0.x
90 }
91
92 /// Sets the x/horizontal component of the point.
93 ///
94 /// # Examples
95 ///
96 /// ```
97 /// use geo_types::Point;
98 ///
99 /// let mut p = Point::new(1.234, 2.345);
100 /// p.set_x(9.876);
101 ///
102 /// assert_eq!(p.x(), 9.876);
103 /// ```
104 pub fn set_x(&mut self, x: T) -> &mut Self {
105 self.0.x = x;
106 self
107 }
108
109 /// Returns a mutable reference to the x/horizontal component of the point
110 ///
111 /// # Examples
112 ///
113 /// ```
114 /// use approx::assert_relative_eq;
115 /// use geo_types::Point;
116 /// let mut p = Point::new(1.234, 2.345);
117 /// let mut p_x = p.x_mut();
118 /// *p_x += 1.0;
119 /// assert_relative_eq!(p.x(), 2.234);
120 /// ```
121 pub fn x_mut(&mut self) -> &mut T {
122 &mut self.0.x
123 }
124 /// Returns the y/vertical component of the point.
125 ///
126 /// # Examples
127 ///
128 /// ```
129 /// use geo_types::Point;
130 ///
131 /// let p = Point::new(1.234, 2.345);
132 ///
133 /// assert_eq!(p.y(), 2.345);
134 /// ```
135 pub fn y(self) -> T {
136 self.0.y
137 }
138
139 /// Sets the y/vertical component of the point.
140 ///
141 /// # Examples
142 ///
143 /// ```
144 /// use geo_types::Point;
145 ///
146 /// let mut p = Point::new(1.234, 2.345);
147 /// p.set_y(9.876);
148 ///
149 /// assert_eq!(p.y(), 9.876);
150 /// ```
151 pub fn set_y(&mut self, y: T) -> &mut Self {
152 self.0.y = y;
153 self
154 }
155
156 /// Returns a mutable reference to the x/horizontal component of the point
157 ///
158 /// # Examples
159 ///
160 /// ```
161 /// use approx::assert_relative_eq;
162 /// use geo_types::Point;
163 /// let mut p = Point::new(1.234, 2.345);
164 /// let mut p_y = p.y_mut();
165 /// *p_y += 1.0;
166 /// assert_relative_eq!(p.y(), 3.345);
167 /// ```
168 pub fn y_mut(&mut self) -> &mut T {
169 &mut self.0.y
170 }
171
172 /// Returns a tuple that contains the x/horizontal & y/vertical component of the point.
173 ///
174 /// # Examples
175 ///
176 /// ```
177 /// use geo_types::Point;
178 ///
179 /// let mut p = Point::new(1.234, 2.345);
180 /// let (x, y) = p.x_y();
181 ///
182 /// assert_eq!(y, 2.345);
183 /// assert_eq!(x, 1.234);
184 /// ```
185 pub fn x_y(self) -> (T, T) {
186 (self.0.x, self.0.y)
187 }
188 /// Returns the longitude/horizontal component of the point.
189 ///
190 /// # Examples
191 ///
192 /// ```
193 /// use geo_types::Point;
194 ///
195 /// let p = Point::new(1.234, 2.345);
196 ///
197 /// assert_eq!(p.x(), 1.234);
198 /// ```
199 #[deprecated = "use `Point::x` instead, it's less ambiguous"]
200 pub fn lng(self) -> T {
201 self.x()
202 }
203
204 /// Sets the longitude/horizontal component of the point.
205 ///
206 /// # Examples
207 ///
208 /// ```
209 /// use geo_types::Point;
210 ///
211 /// let mut p = Point::new(1.234, 2.345);
212 /// #[allow(deprecated)]
213 /// p.set_lng(9.876);
214 ///
215 /// assert_eq!(p.x(), 9.876);
216 /// ```
217 #[deprecated = "use `Point::set_x` instead, it's less ambiguous"]
218 pub fn set_lng(&mut self, lng: T) -> &mut Self {
219 self.set_x(lng)
220 }
221
222 /// Returns the latitude/vertical component of the point.
223 ///
224 /// # Examples
225 ///
226 /// ```
227 /// use geo_types::Point;
228 ///
229 /// let p = Point::new(1.234, 2.345);
230 ///
231 /// assert_eq!(p.y(), 2.345);
232 /// ```
233 #[deprecated = "use `Point::y` instead, it's less ambiguous"]
234 pub fn lat(self) -> T {
235 self.y()
236 }
237 /// Sets the latitude/vertical component of the point.
238 ///
239 /// # Examples
240 ///
241 /// ```
242 /// use geo_types::Point;
243 ///
244 /// let mut p = Point::new(1.234, 2.345);
245 /// #[allow(deprecated)]
246 /// p.set_lat(9.876);
247 ///
248 /// assert_eq!(p.y(), 9.876);
249 /// ```
250 #[deprecated = "use `Point::set_y` instead, it's less ambiguous"]
251 pub fn set_lat(&mut self, lat: T) -> &mut Self {
252 self.set_y(lat)
253 }
254}
255
256impl<T: CoordNum> Point<T> {
257 /// Returns the dot product of the two points:
258 /// `dot = x1 * x2 + y1 * y2`
259 ///
260 /// # Examples
261 ///
262 /// ```
263 /// use geo_types::{point, Point};
264 ///
265 /// let point = point! { x: 1.5, y: 0.5 };
266 /// let dot = point.dot(point! { x: 2.0, y: 4.5 });
267 ///
268 /// assert_eq!(dot, 5.25);
269 /// ```
270 pub fn dot(self, other: Self) -> T {
271 self.x() * other.x() + self.y() * other.y()
272 }
273
274 /// Returns the cross product of 3 points. A positive value implies
275 /// `self` → `point_b` → `point_c` is counter-clockwise, negative implies
276 /// clockwise.
277 ///
278 /// # Note on Robustness
279 ///
280 /// This function is **not** robust against floating-point errors.
281 /// The [`geo`](https://docs.rs/geo) crate
282 /// offers robust predicates for standard numeric types using the
283 /// [`Kernel`](https://docs.rs/geo/algorithm/kernels/trait.Kernel.html)
284 /// trait, and these should be preferred if possible.
285 ///
286 /// # Examples
287 ///
288 /// ```
289 /// use geo_types::point;
290 ///
291 /// let point_a = point! { x: 1., y: 2. };
292 /// let point_b = point! { x: 3., y: 5. };
293 /// let point_c = point! { x: 7., y: 12. };
294 ///
295 /// let cross = point_a.cross_prod(point_b, point_c);
296 ///
297 /// assert_eq!(cross, 2.0)
298 /// ```
299 pub fn cross_prod(self, point_b: Self, point_c: Self) -> T {
300 (point_b.x() - self.x()) * (point_c.y() - self.y())
301 - (point_b.y() - self.y()) * (point_c.x() - self.x())
302 }
303}
304
305impl<T: CoordFloat> Point<T> {
306 /// Converts the (x,y) components of Point to degrees
307 ///
308 /// # Example
309 /// ```
310 /// use geo_types::Point;
311 ///
312 /// let p = Point::new(1.234, 2.345);
313 /// let (x, y): (f32, f32) = p.to_degrees().x_y();
314 /// assert_eq!(x.round(), 71.0);
315 /// assert_eq!(y.round(), 134.0);
316 /// ```
317 pub fn to_degrees(self) -> Self {
318 let (x, y) = self.x_y();
319 let x = x.to_degrees();
320 let y = y.to_degrees();
321 Point::new(x, y)
322 }
323
324 /// Converts the (x,y) components of Point to radians
325 ///
326 /// # Example
327 /// ```
328 /// use geo_types::Point;
329 ///
330 /// let p = Point::new(180.0, 341.5);
331 /// let (x, y): (f32, f32) = p.to_radians().x_y();
332 /// assert_eq!(x.round(), 3.0);
333 /// assert_eq!(y.round(), 6.0);
334 /// ```
335 pub fn to_radians(self) -> Self {
336 let (x, y) = self.x_y();
337 let x = x.to_radians();
338 let y = y.to_radians();
339 Point::new(x, y)
340 }
341}
342
343impl<T> Neg for Point<T>
344where
345 T: CoordNum + Neg<Output = T>,
346{
347 type Output = Self;
348
349 /// Returns a point with the x and y components negated.
350 ///
351 /// # Examples
352 ///
353 /// ```
354 /// use geo_types::Point;
355 ///
356 /// let p = -Point::new(-1.25, 2.5);
357 ///
358 /// assert_eq!(p.x(), 1.25);
359 /// assert_eq!(p.y(), -2.5);
360 /// ```
361 fn neg(self) -> Self::Output {
362 Point::from(-self.0)
363 }
364}
365
366impl<T: CoordNum> Add for Point<T> {
367 type Output = Self;
368
369 /// Add a point to the given point.
370 ///
371 /// # Examples
372 ///
373 /// ```
374 /// use geo_types::Point;
375 ///
376 /// let p = Point::new(1.25, 2.5) + Point::new(1.5, 2.5);
377 ///
378 /// assert_eq!(p.x(), 2.75);
379 /// assert_eq!(p.y(), 5.0);
380 /// ```
381 fn add(self, rhs: Self) -> Self::Output {
382 Point::from(self.0 + rhs.0)
383 }
384}
385
386impl<T: CoordNum> AddAssign for Point<T> {
387 /// Add a point to the given point and assign it to the original point.
388 ///
389 /// # Examples
390 ///
391 /// ```
392 /// use geo_types::Point;
393 ///
394 /// let mut p = Point::new(1.25, 2.5);
395 /// p += Point::new(1.5, 2.5);
396 ///
397 /// assert_eq!(p.x(), 2.75);
398 /// assert_eq!(p.y(), 5.0);
399 /// ```
400 fn add_assign(&mut self, rhs: Self) {
401 self.0 = self.0 + rhs.0;
402 }
403}
404
405impl<T: CoordNum> Sub for Point<T> {
406 type Output = Self;
407
408 /// Subtract a point from the given point.
409 ///
410 /// # Examples
411 ///
412 /// ```
413 /// use geo_types::Point;
414 ///
415 /// let p = Point::new(1.25, 3.0) - Point::new(1.5, 2.5);
416 ///
417 /// assert_eq!(p.x(), -0.25);
418 /// assert_eq!(p.y(), 0.5);
419 /// ```
420 fn sub(self, rhs: Self) -> Self::Output {
421 Point::from(self.0 - rhs.0)
422 }
423}
424
425impl<T: CoordNum> SubAssign for Point<T> {
426 /// Subtract a point from the given point and assign it to the original point.
427 ///
428 /// # Examples
429 ///
430 /// ```
431 /// use geo_types::Point;
432 ///
433 /// let mut p = Point::new(1.25, 2.5);
434 /// p -= Point::new(1.5, 2.5);
435 ///
436 /// assert_eq!(p.x(), -0.25);
437 /// assert_eq!(p.y(), 0.0);
438 /// ```
439 fn sub_assign(&mut self, rhs: Self) {
440 self.0 = self.0 - rhs.0;
441 }
442}
443
444impl<T: CoordNum> Mul<T> for Point<T> {
445 type Output = Self;
446
447 /// Scaler multiplication of a point
448 ///
449 /// # Examples
450 ///
451 /// ```
452 /// use geo_types::Point;
453 ///
454 /// let p = Point::new(2.0, 3.0) * 2.0;
455 ///
456 /// assert_eq!(p.x(), 4.0);
457 /// assert_eq!(p.y(), 6.0);
458 /// ```
459 fn mul(self, rhs: T) -> Self::Output {
460 Point::from(self.0 * rhs)
461 }
462}
463
464impl<T: CoordNum> MulAssign<T> for Point<T> {
465 /// Scaler multiplication of a point in place
466 ///
467 /// # Examples
468 ///
469 /// ```
470 /// use geo_types::Point;
471 ///
472 /// let mut p = Point::new(2.0, 3.0);
473 /// p *= 2.0;
474 ///
475 /// assert_eq!(p.x(), 4.0);
476 /// assert_eq!(p.y(), 6.0);
477 /// ```
478 fn mul_assign(&mut self, rhs: T) {
479 self.0 = self.0 * rhs
480 }
481}
482
483impl<T: CoordNum> Div<T> for Point<T> {
484 type Output = Self;
485
486 /// Scaler division of a point
487 ///
488 /// # Examples
489 ///
490 /// ```
491 /// use geo_types::Point;
492 ///
493 /// let p = Point::new(2.0, 3.0) / 2.0;
494 ///
495 /// assert_eq!(p.x(), 1.0);
496 /// assert_eq!(p.y(), 1.5);
497 /// ```
498 fn div(self, rhs: T) -> Self::Output {
499 Point::from(self.0 / rhs)
500 }
501}
502
503impl<T: CoordNum> DivAssign<T> for Point<T> {
504 /// Scaler division of a point in place
505 ///
506 /// # Examples
507 ///
508 /// ```
509 /// use geo_types::Point;
510 ///
511 /// let mut p = Point::new(2.0, 3.0);
512 /// p /= 2.0;
513 ///
514 /// assert_eq!(p.x(), 1.0);
515 /// assert_eq!(p.y(), 1.5);
516 /// ```
517 fn div_assign(&mut self, rhs: T) {
518 self.0 = self.0 / rhs
519 }
520}
521
522#[cfg(any(feature = "approx", test))]
523mod approx_integration {
524 use super::*;
525 use approx::{AbsDiffEq, RelativeEq, UlpsEq};
526
527 impl<T> RelativeEq for Point<T>
528 where
529 T: CoordNum + RelativeEq<Epsilon = T>,
530 {
531 #[inline]
532 fn default_max_relative() -> Self::Epsilon {
533 T::default_max_relative()
534 }
535
536 /// Equality assertion within a relative limit.
537 ///
538 /// # Examples
539 ///
540 /// ```
541 /// use geo_types::Point;
542 ///
543 /// let a = Point::new(2.0, 3.0);
544 /// let b = Point::new(2.0, 3.01);
545 ///
546 /// approx::assert_relative_eq!(a, b, max_relative=0.1)
547 /// ```
548 #[inline]
549 fn relative_eq(
550 &self,
551 other: &Self,
552 epsilon: Self::Epsilon,
553 max_relative: Self::Epsilon,
554 ) -> bool {
555 self.0.relative_eq(&other.0, epsilon, max_relative)
556 }
557 }
558
559 impl<T> AbsDiffEq for Point<T>
560 where
561 T: CoordNum + AbsDiffEq<Epsilon = T>,
562 {
563 type Epsilon = T::Epsilon;
564
565 #[inline]
566 fn default_epsilon() -> Self::Epsilon {
567 T::default_epsilon()
568 }
569
570 /// Equality assertion with an absolute limit.
571 ///
572 /// # Examples
573 ///
574 /// ```
575 /// use geo_types::Point;
576 ///
577 /// let a = Point::new(2.0, 3.0);
578 /// let b = Point::new(2.0, 3.0000001);
579 ///
580 /// approx::assert_relative_eq!(a, b, epsilon=0.1)
581 /// ```
582 #[inline]
583 fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
584 self.0.abs_diff_eq(&other.0, epsilon)
585 }
586 }
587
588 impl<T> UlpsEq for Point<T>
589 where
590 T: CoordNum + UlpsEq<Epsilon = T>,
591 {
592 fn default_max_ulps() -> u32 {
593 T::default_max_ulps()
594 }
595
596 fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool {
597 self.0.ulps_eq(&other.0, epsilon, max_ulps)
598 }
599 }
600}
601
602#[cfg(feature = "rstar_0_8")]
603// These are required for rstar RTree
604impl<T> ::rstar_0_8::Point for Point<T>
605where
606 T: ::num_traits::Float + ::rstar_0_8::RTreeNum,
607{
608 type Scalar = T;
609
610 const DIMENSIONS: usize = 2;
611
612 fn generate(generator: impl Fn(usize) -> Self::Scalar) -> Self {
613 Point::new(generator(0), generator(1))
614 }
615
616 fn nth(&self, index: usize) -> Self::Scalar {
617 match index {
618 0 => self.0.x,
619 1 => self.0.y,
620 _ => unreachable!(),
621 }
622 }
623 fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
624 match index {
625 0 => &mut self.0.x,
626 1 => &mut self.0.y,
627 _ => unreachable!(),
628 }
629 }
630}
631
632#[cfg(feature = "rstar_0_9")]
633impl<T> ::rstar_0_9::Point for Point<T>
634where
635 T: ::num_traits::Float + ::rstar_0_9::RTreeNum,
636{
637 type Scalar = T;
638
639 const DIMENSIONS: usize = 2;
640
641 fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
642 Point::new(generator(0), generator(1))
643 }
644
645 fn nth(&self, index: usize) -> Self::Scalar {
646 match index {
647 0 => self.0.x,
648 1 => self.0.y,
649 _ => unreachable!(),
650 }
651 }
652 fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
653 match index {
654 0 => &mut self.0.x,
655 1 => &mut self.0.y,
656 _ => unreachable!(),
657 }
658 }
659}
660
661#[cfg(feature = "rstar_0_10")]
662impl<T> ::rstar_0_10::Point for Point<T>
663where
664 T: ::num_traits::Float + ::rstar_0_10::RTreeNum,
665{
666 type Scalar = T;
667
668 const DIMENSIONS: usize = 2;
669
670 fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
671 Point::new(generator(0), generator(1))
672 }
673
674 fn nth(&self, index: usize) -> Self::Scalar {
675 match index {
676 0 => self.0.x,
677 1 => self.0.y,
678 _ => unreachable!(),
679 }
680 }
681 fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
682 match index {
683 0 => &mut self.0.x,
684 1 => &mut self.0.y,
685 _ => unreachable!(),
686 }
687 }
688}
689
690#[cfg(feature = "rstar_0_11")]
691impl<T> ::rstar_0_11::Point for Point<T>
692where
693 T: ::num_traits::Float + ::rstar_0_11::RTreeNum,
694{
695 type Scalar = T;
696
697 const DIMENSIONS: usize = 2;
698
699 fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
700 Point::new(generator(0), generator(1))
701 }
702
703 fn nth(&self, index: usize) -> Self::Scalar {
704 match index {
705 0 => self.0.x,
706 1 => self.0.y,
707 _ => unreachable!(),
708 }
709 }
710 fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
711 match index {
712 0 => &mut self.0.x,
713 1 => &mut self.0.y,
714 _ => unreachable!(),
715 }
716 }
717}
718
719#[cfg(feature = "rstar_0_12")]
720impl<T> ::rstar_0_12::Point for Point<T>
721where
722 T: ::num_traits::Float + ::rstar_0_12::RTreeNum,
723{
724 type Scalar = T;
725
726 const DIMENSIONS: usize = 2;
727
728 fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
729 Point::new(generator(0), generator(1))
730 }
731
732 fn nth(&self, index: usize) -> Self::Scalar {
733 match index {
734 0 => self.0.x,
735 1 => self.0.y,
736 _ => unreachable!(),
737 }
738 }
739 fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
740 match index {
741 0 => &mut self.0.x,
742 1 => &mut self.0.y,
743 _ => unreachable!(),
744 }
745 }
746}
747
748impl<T: CoordNum> AsRef<Coord<T>> for Point<T> {
749 fn as_ref(&self) -> &Coord<T> {
750 &self.0
751 }
752}
753
754#[cfg(test)]
755mod test {
756 use super::*;
757
758 use approx::{AbsDiffEq, RelativeEq};
759
760 #[test]
761 fn test_abs_diff_eq() {
762 let delta = 1e-6;
763 let p = Point::new(1.0, 1.0);
764
765 let p_x = Point::new(1.0 - delta, 1.0);
766 assert!(p.abs_diff_eq(&p_x, 1e-2));
767 assert!(p.abs_diff_ne(&p_x, 1e-12));
768
769 let p_y = Point::new(1.0, 1.0 + delta);
770 assert!(p.abs_diff_eq(&p_y, 1e-2));
771 assert!(p.abs_diff_ne(&p_y, 1e-12));
772
773 let p_xy = Point::new(1.0 + delta, 1.0 - delta);
774 assert!(p.abs_diff_eq(&p_xy, 1e-2));
775 assert!(p.abs_diff_ne(&p_xy, 1e-12));
776
777 let p_inf = Point::new(f64::INFINITY, 1.);
778 assert!(p.abs_diff_ne(&p_inf, 1e-2));
779 }
780
781 #[test]
782 fn test_relative_eq() {
783 let delta = 1e-6;
784 let p = Point::new(1.0, 1.0);
785
786 let p_x = Point::new(1.0 - delta, 1.0);
787 assert!(p.relative_eq(&p_x, 1e-2, 1e-2));
788 assert!(p.relative_ne(&p_x, 1e-12, 1e-12));
789
790 let p_y = Point::new(1.0, 1.0 + delta);
791 assert!(p.relative_eq(&p_y, 1e-2, 1e-2));
792 assert!(p.relative_ne(&p_y, 1e-12, 1e-12));
793
794 let p_xy = Point::new(1.0 + delta, 1.0 - delta);
795 assert!(p.relative_eq(&p_xy, 1e-2, 1e-2));
796 assert!(p.relative_ne(&p_xy, 1e-12, 1e-12));
797
798 let p_inf = Point::new(f64::INFINITY, 1.);
799 assert!(p.relative_ne(&p_inf, 1e-2, 1e-2));
800 }
801}