pub struct Rect<T = f64>where
T: CoordNum,{ /* private fields */ }Expand description
An axis-aligned bounded 2D rectangle whose area is
defined by minimum and maximum Coords.
The constructors and setters ensure the maximum
Coord is greater than or equal to the minimum.
Thus, a Rects width, height, and area is guaranteed to
be greater than or equal to zero.
Note. While Rect implements MapCoords and
RotatePoint algorithmic traits, the usage is expected
to maintain the axis alignment. In particular, only
rotation by integer multiples of 90 degrees, will
preserve the original shape. In other cases, the min,
and max points are rotated or transformed, and a new
rectangle is created (with coordinate swaps to ensure
min < max).
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 0., y: 4.},
coord! { x: 3., y: 10.},
);
assert_eq!(3., rect.width());
assert_eq!(6., rect.height());
assert_eq!(
coord! { x: 1.5, y: 7. },
rect.center()
);Implementations§
Source§impl<T> Rect<T>where
T: CoordNum,
impl<T> Rect<T>where
T: CoordNum,
Sourcepub fn new<C>(c1: C, c2: C) -> Rect<T>
pub fn new<C>(c1: C, c2: C) -> Rect<T>
Creates a new rectangle from two corner coordinates.
Coords are stored and returned (by iterators) in CCW order
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 10., y: 20. },
coord! { x: 30., y: 10. }
);
assert_eq!(rect.min(), coord! { x: 10., y: 10. });
assert_eq!(rect.max(), coord! { x: 30., y: 20. });pub fn try_new<C>(c1: C, c2: C) -> Result<Rect<T>, InvalidRectCoordinatesError>
Rect::new instead, since Rect::try_new will never ErrorSourcepub fn min(self) -> Coord<T>
pub fn min(self) -> Coord<T>
Returns the minimum Coord of the Rect.
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 5., y: 5. },
coord! { x: 15., y: 15. },
);
assert_eq!(rect.min(), coord! { x: 5., y: 5. });Examples found in repository?
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 println!("=== Advanced Spatial Operations Demo ===\n");
16
17 // Create an in-memory database
18 let mut db = Spatio::memory()?;
19
20 // ========================================
21 // 1. Distance Calculations
22 // ========================================
23 println!("1. Distance Calculations");
24 println!("{}", "=".repeat(50));
25
26 let new_york = Point::new(-74.0060, 40.7128);
27 let los_angeles = Point::new(-118.2437, 34.0522);
28 let london = Point::new(-0.1278, 51.5074);
29
30 // Calculate distances using different metrics
31 let dist_haversine = distance_between(&new_york, &los_angeles, DistanceMetric::Haversine);
32 let dist_geodesic = distance_between(&new_york, &los_angeles, DistanceMetric::Geodesic);
33 let dist_rhumb = distance_between(&new_york, &los_angeles, DistanceMetric::Rhumb);
34
35 println!("NYC to LA:");
36 println!(" Haversine: {:.2} km", dist_haversine / 1000.0);
37 println!(" Geodesic: {:.2} km", dist_geodesic / 1000.0);
38 println!(" Rhumb: {:.2} km", dist_rhumb / 1000.0);
39
40 // Using the database method
41 let db_distance = db.distance_between(&new_york, &london, DistanceMetric::Haversine)?;
42 println!("\nNYC to London: {:.2} km", db_distance / 1000.0);
43
44 // ========================================
45 // 2. K-Nearest-Neighbors (KNN)
46 // ========================================
47 println!("\n2. K-Nearest-Neighbors Query");
48 println!("{}", "=".repeat(50));
49
50 // Insert major cities
51 let cities = vec![
52 (Point::new(-74.0060, 40.7128), "New York", "USA"),
53 (Point::new(-118.2437, 34.0522), "Los Angeles", "USA"),
54 (Point::new(-87.6298, 41.8781), "Chicago", "USA"),
55 (Point::new(-95.3698, 29.7604), "Houston", "USA"),
56 (Point::new(-75.1652, 39.9526), "Philadelphia", "USA"),
57 (Point::new(-122.4194, 37.7749), "San Francisco", "USA"),
58 (Point::new(-0.1278, 51.5074), "London", "UK"),
59 (Point::new(2.3522, 48.8566), "Paris", "France"),
60 (Point::new(139.6917, 35.6895), "Tokyo", "Japan"),
61 ];
62
63 for (point, name, country) in &cities {
64 let data = format!("{},{}", name, country);
65 db.insert_point("world_cities", point, data.as_bytes(), None)?;
66 }
67
68 // Find 3 nearest cities to a query point (somewhere in New Jersey)
69 let query_point = Point::new(-74.1719, 40.7357);
70 let nearest = db.knn(
71 "world_cities",
72 &query_point,
73 3,
74 500_000.0, // Search within 500km
75 DistanceMetric::Haversine,
76 )?;
77
78 println!("3 nearest cities to query point:");
79 for (i, (_point, data, distance)) in nearest.iter().enumerate() {
80 let city_info = String::from_utf8_lossy(data);
81 println!(
82 " {}. {} ({:.2} km away)",
83 i + 1,
84 city_info,
85 distance / 1000.0
86 );
87 }
88
89 // ========================================
90 // 3. Polygon Queries
91 // ========================================
92 println!("\n3. Polygon Queries");
93 println!("{}", "=".repeat(50));
94
95 // Define a polygon covering parts of the eastern US
96 use geo::polygon;
97 let east_coast_polygon = polygon![
98 (x: -80.0, y: 35.0), // South
99 (x: -70.0, y: 35.0), // Southeast
100 (x: -70.0, y: 45.0), // Northeast
101 (x: -80.0, y: 45.0), // Northwest
102 (x: -80.0, y: 35.0), // Close the polygon
103 ];
104 let east_coast_polygon: Polygon = east_coast_polygon.into();
105
106 let cities_in_polygon = db.query_within_polygon("world_cities", &east_coast_polygon, 100)?;
107
108 println!("Cities within East Coast polygon:");
109 for (point, data) in &cities_in_polygon {
110 let city_info = String::from_utf8_lossy(data);
111 println!(" - {} at ({:.4}, {:.4})", city_info, point.x(), point.y());
112 }
113
114 // ========================================
115 // 4. Bounding Box Operations
116 // ========================================
117 println!("\n4. Bounding Box Operations");
118 println!("{}", "=".repeat(50));
119
120 // Create a bounding box around the New York area
121 let ny_bbox = bounding_box(-74.5, 40.5, -73.5, 41.0)?;
122 println!("NY Area Bounding Box: {:?}", ny_bbox);
123
124 // Find cities in bounding box
125 let cities_in_bbox = db.find_within_bounds("world_cities", 40.5, -74.5, 41.0, -73.5, 100)?;
126 println!("\nCities in NY area bounding box:");
127 for (_point, data) in &cities_in_bbox {
128 let city_info = String::from_utf8_lossy(data);
129 println!(" - {}", city_info);
130 }
131
132 // ========================================
133 // 5. Convex Hull
134 // ========================================
135 println!("\n5. Convex Hull Calculation");
136 println!("{}", "=".repeat(50));
137
138 // Get all city points
139 let city_points: Vec<Point> = cities.iter().map(|(p, _, _)| *p).collect();
140
141 // Calculate convex hull
142 if let Some(hull) = convex_hull(&city_points) {
143 println!("Convex hull of all cities:");
144 println!(" Exterior points: {}", hull.exterior().0.len() - 1);
145 for coord in hull.exterior().0.iter().take(5) {
146 println!(" ({:.4}, {:.4})", coord.x, coord.y);
147 }
148 }
149
150 // ========================================
151 // 6. Bounding Rectangle
152 // ========================================
153 println!("\n6. Bounding Rectangle");
154 println!("{}", "=".repeat(50));
155
156 if let Some(bbox) = bounding_rect_for_points(&city_points) {
157 println!("Bounding rectangle of all cities:");
158 println!(" Min: ({:.4}, {:.4})", bbox.min().x, bbox.min().y);
159 println!(" Max: ({:.4}, {:.4})", bbox.max().x, bbox.max().y);
160 println!(" Width: {:.2}°", bbox.max().x - bbox.min().x);
161 println!(" Height: {:.2}°", bbox.max().y - bbox.min().y);
162 }
163
164 // ========================================
165 // 7. Advanced Radius Queries
166 // ========================================
167 println!("\n7. Advanced Radius Queries");
168 println!("{}", "=".repeat(50));
169
170 // Count cities within 1000km of NYC
171 let count = db.count_within_radius("world_cities", &new_york, 1_000_000.0)?;
172 println!("Cities within 1000km of NYC: {}", count);
173
174 // Check if any cities exist within 100km
175 let has_nearby = db.intersects_radius("world_cities", &new_york, 100_000.0)?;
176 println!("Has cities within 100km of NYC: {}", has_nearby);
177
178 // Query with radius
179 let nearby = db.query_within_radius("world_cities", &new_york, 200_000.0, 10)?;
180 println!("\nCities within 200km of NYC:");
181 for (point, data, _distance) in &nearby {
182 let city_info = String::from_utf8_lossy(data);
183 let dist = distance_between(&new_york, point, DistanceMetric::Haversine);
184 println!(" - {} ({:.2} km)", city_info, dist / 1000.0);
185 }
186
187 // ========================================
188 // 8. Spatial Analytics
189 // ========================================
190 println!("\n8. Spatial Analytics");
191 println!("{}", "=".repeat(50));
192
193 // Find the two most distant cities (brute force)
194 let mut max_distance = 0.0;
195 let mut furthest_pair = ("", "");
196
197 for (i, (p1, n1, _)) in cities.iter().enumerate() {
198 for (p2, n2, _) in cities.iter().skip(i + 1) {
199 let dist = distance_between(p1, p2, DistanceMetric::Geodesic);
200 if dist > max_distance {
201 max_distance = dist;
202 furthest_pair = (n1, n2);
203 }
204 }
205 }
206
207 println!(
208 "Most distant city pair: {} ↔ {}",
209 furthest_pair.0, furthest_pair.1
210 );
211 println!("Distance: {:.2} km", max_distance / 1000.0);
212
213 // Calculate average distance between all US cities
214 let us_cities: Vec<_> = cities
215 .iter()
216 .filter(|(_, _, country)| *country == "USA")
217 .collect();
218
219 if us_cities.len() > 1 {
220 let mut total_distance = 0.0;
221 let mut count = 0;
222
223 for (i, (p1, _, _)) in us_cities.iter().enumerate() {
224 for (p2, _, _) in us_cities.iter().skip(i + 1) {
225 total_distance += distance_between(p1, p2, DistanceMetric::Haversine);
226 count += 1;
227 }
228 }
229
230 let avg_distance = total_distance / count as f64;
231 println!(
232 "\nAverage distance between US cities: {:.2} km",
233 avg_distance / 1000.0
234 );
235 }
236
237 // ========================================
238 // Summary
239 // ========================================
240 println!("\n{}", "=".repeat(50));
241 println!("Summary:");
242 println!(" - Demonstrated multiple distance metrics");
243 println!(" - Performed K-nearest-neighbor searches");
244 println!(" - Queried points within polygons");
245 println!(" - Used bounding box operations");
246 println!(" - Calculated convex hulls");
247 println!(" - Performed spatial analytics");
248 println!("\nAll spatial operations leverage the geo crate!");
249
250 Ok(())
251}Sourcepub fn set_min<C>(&mut self, min: C)
pub fn set_min<C>(&mut self, min: C)
Set the Rect’s minimum coordinate.
§Panics
Panics if min’s x/y is greater than the maximum coordinate’s x/y.
Sourcepub fn max(self) -> Coord<T>
pub fn max(self) -> Coord<T>
Returns the maximum Coord of the Rect.
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 5., y: 5. },
coord! { x: 15., y: 15. },
);
assert_eq!(rect.max(), coord! { x: 15., y: 15. });Examples found in repository?
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 println!("=== Advanced Spatial Operations Demo ===\n");
16
17 // Create an in-memory database
18 let mut db = Spatio::memory()?;
19
20 // ========================================
21 // 1. Distance Calculations
22 // ========================================
23 println!("1. Distance Calculations");
24 println!("{}", "=".repeat(50));
25
26 let new_york = Point::new(-74.0060, 40.7128);
27 let los_angeles = Point::new(-118.2437, 34.0522);
28 let london = Point::new(-0.1278, 51.5074);
29
30 // Calculate distances using different metrics
31 let dist_haversine = distance_between(&new_york, &los_angeles, DistanceMetric::Haversine);
32 let dist_geodesic = distance_between(&new_york, &los_angeles, DistanceMetric::Geodesic);
33 let dist_rhumb = distance_between(&new_york, &los_angeles, DistanceMetric::Rhumb);
34
35 println!("NYC to LA:");
36 println!(" Haversine: {:.2} km", dist_haversine / 1000.0);
37 println!(" Geodesic: {:.2} km", dist_geodesic / 1000.0);
38 println!(" Rhumb: {:.2} km", dist_rhumb / 1000.0);
39
40 // Using the database method
41 let db_distance = db.distance_between(&new_york, &london, DistanceMetric::Haversine)?;
42 println!("\nNYC to London: {:.2} km", db_distance / 1000.0);
43
44 // ========================================
45 // 2. K-Nearest-Neighbors (KNN)
46 // ========================================
47 println!("\n2. K-Nearest-Neighbors Query");
48 println!("{}", "=".repeat(50));
49
50 // Insert major cities
51 let cities = vec![
52 (Point::new(-74.0060, 40.7128), "New York", "USA"),
53 (Point::new(-118.2437, 34.0522), "Los Angeles", "USA"),
54 (Point::new(-87.6298, 41.8781), "Chicago", "USA"),
55 (Point::new(-95.3698, 29.7604), "Houston", "USA"),
56 (Point::new(-75.1652, 39.9526), "Philadelphia", "USA"),
57 (Point::new(-122.4194, 37.7749), "San Francisco", "USA"),
58 (Point::new(-0.1278, 51.5074), "London", "UK"),
59 (Point::new(2.3522, 48.8566), "Paris", "France"),
60 (Point::new(139.6917, 35.6895), "Tokyo", "Japan"),
61 ];
62
63 for (point, name, country) in &cities {
64 let data = format!("{},{}", name, country);
65 db.insert_point("world_cities", point, data.as_bytes(), None)?;
66 }
67
68 // Find 3 nearest cities to a query point (somewhere in New Jersey)
69 let query_point = Point::new(-74.1719, 40.7357);
70 let nearest = db.knn(
71 "world_cities",
72 &query_point,
73 3,
74 500_000.0, // Search within 500km
75 DistanceMetric::Haversine,
76 )?;
77
78 println!("3 nearest cities to query point:");
79 for (i, (_point, data, distance)) in nearest.iter().enumerate() {
80 let city_info = String::from_utf8_lossy(data);
81 println!(
82 " {}. {} ({:.2} km away)",
83 i + 1,
84 city_info,
85 distance / 1000.0
86 );
87 }
88
89 // ========================================
90 // 3. Polygon Queries
91 // ========================================
92 println!("\n3. Polygon Queries");
93 println!("{}", "=".repeat(50));
94
95 // Define a polygon covering parts of the eastern US
96 use geo::polygon;
97 let east_coast_polygon = polygon![
98 (x: -80.0, y: 35.0), // South
99 (x: -70.0, y: 35.0), // Southeast
100 (x: -70.0, y: 45.0), // Northeast
101 (x: -80.0, y: 45.0), // Northwest
102 (x: -80.0, y: 35.0), // Close the polygon
103 ];
104 let east_coast_polygon: Polygon = east_coast_polygon.into();
105
106 let cities_in_polygon = db.query_within_polygon("world_cities", &east_coast_polygon, 100)?;
107
108 println!("Cities within East Coast polygon:");
109 for (point, data) in &cities_in_polygon {
110 let city_info = String::from_utf8_lossy(data);
111 println!(" - {} at ({:.4}, {:.4})", city_info, point.x(), point.y());
112 }
113
114 // ========================================
115 // 4. Bounding Box Operations
116 // ========================================
117 println!("\n4. Bounding Box Operations");
118 println!("{}", "=".repeat(50));
119
120 // Create a bounding box around the New York area
121 let ny_bbox = bounding_box(-74.5, 40.5, -73.5, 41.0)?;
122 println!("NY Area Bounding Box: {:?}", ny_bbox);
123
124 // Find cities in bounding box
125 let cities_in_bbox = db.find_within_bounds("world_cities", 40.5, -74.5, 41.0, -73.5, 100)?;
126 println!("\nCities in NY area bounding box:");
127 for (_point, data) in &cities_in_bbox {
128 let city_info = String::from_utf8_lossy(data);
129 println!(" - {}", city_info);
130 }
131
132 // ========================================
133 // 5. Convex Hull
134 // ========================================
135 println!("\n5. Convex Hull Calculation");
136 println!("{}", "=".repeat(50));
137
138 // Get all city points
139 let city_points: Vec<Point> = cities.iter().map(|(p, _, _)| *p).collect();
140
141 // Calculate convex hull
142 if let Some(hull) = convex_hull(&city_points) {
143 println!("Convex hull of all cities:");
144 println!(" Exterior points: {}", hull.exterior().0.len() - 1);
145 for coord in hull.exterior().0.iter().take(5) {
146 println!(" ({:.4}, {:.4})", coord.x, coord.y);
147 }
148 }
149
150 // ========================================
151 // 6. Bounding Rectangle
152 // ========================================
153 println!("\n6. Bounding Rectangle");
154 println!("{}", "=".repeat(50));
155
156 if let Some(bbox) = bounding_rect_for_points(&city_points) {
157 println!("Bounding rectangle of all cities:");
158 println!(" Min: ({:.4}, {:.4})", bbox.min().x, bbox.min().y);
159 println!(" Max: ({:.4}, {:.4})", bbox.max().x, bbox.max().y);
160 println!(" Width: {:.2}°", bbox.max().x - bbox.min().x);
161 println!(" Height: {:.2}°", bbox.max().y - bbox.min().y);
162 }
163
164 // ========================================
165 // 7. Advanced Radius Queries
166 // ========================================
167 println!("\n7. Advanced Radius Queries");
168 println!("{}", "=".repeat(50));
169
170 // Count cities within 1000km of NYC
171 let count = db.count_within_radius("world_cities", &new_york, 1_000_000.0)?;
172 println!("Cities within 1000km of NYC: {}", count);
173
174 // Check if any cities exist within 100km
175 let has_nearby = db.intersects_radius("world_cities", &new_york, 100_000.0)?;
176 println!("Has cities within 100km of NYC: {}", has_nearby);
177
178 // Query with radius
179 let nearby = db.query_within_radius("world_cities", &new_york, 200_000.0, 10)?;
180 println!("\nCities within 200km of NYC:");
181 for (point, data, _distance) in &nearby {
182 let city_info = String::from_utf8_lossy(data);
183 let dist = distance_between(&new_york, point, DistanceMetric::Haversine);
184 println!(" - {} ({:.2} km)", city_info, dist / 1000.0);
185 }
186
187 // ========================================
188 // 8. Spatial Analytics
189 // ========================================
190 println!("\n8. Spatial Analytics");
191 println!("{}", "=".repeat(50));
192
193 // Find the two most distant cities (brute force)
194 let mut max_distance = 0.0;
195 let mut furthest_pair = ("", "");
196
197 for (i, (p1, n1, _)) in cities.iter().enumerate() {
198 for (p2, n2, _) in cities.iter().skip(i + 1) {
199 let dist = distance_between(p1, p2, DistanceMetric::Geodesic);
200 if dist > max_distance {
201 max_distance = dist;
202 furthest_pair = (n1, n2);
203 }
204 }
205 }
206
207 println!(
208 "Most distant city pair: {} ↔ {}",
209 furthest_pair.0, furthest_pair.1
210 );
211 println!("Distance: {:.2} km", max_distance / 1000.0);
212
213 // Calculate average distance between all US cities
214 let us_cities: Vec<_> = cities
215 .iter()
216 .filter(|(_, _, country)| *country == "USA")
217 .collect();
218
219 if us_cities.len() > 1 {
220 let mut total_distance = 0.0;
221 let mut count = 0;
222
223 for (i, (p1, _, _)) in us_cities.iter().enumerate() {
224 for (p2, _, _) in us_cities.iter().skip(i + 1) {
225 total_distance += distance_between(p1, p2, DistanceMetric::Haversine);
226 count += 1;
227 }
228 }
229
230 let avg_distance = total_distance / count as f64;
231 println!(
232 "\nAverage distance between US cities: {:.2} km",
233 avg_distance / 1000.0
234 );
235 }
236
237 // ========================================
238 // Summary
239 // ========================================
240 println!("\n{}", "=".repeat(50));
241 println!("Summary:");
242 println!(" - Demonstrated multiple distance metrics");
243 println!(" - Performed K-nearest-neighbor searches");
244 println!(" - Queried points within polygons");
245 println!(" - Used bounding box operations");
246 println!(" - Calculated convex hulls");
247 println!(" - Performed spatial analytics");
248 println!("\nAll spatial operations leverage the geo crate!");
249
250 Ok(())
251}Sourcepub fn set_max<C>(&mut self, max: C)
pub fn set_max<C>(&mut self, max: C)
Set the Rect’s maximum coordinate.
§Panics
Panics if max’s x/y is less than the minimum coordinate’s x/y.
Sourcepub fn width(self) -> T
pub fn width(self) -> T
Returns the width of the Rect.
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 5., y: 5. },
coord! { x: 15., y: 15. },
);
assert_eq!(rect.width(), 10.);Sourcepub fn height(self) -> T
pub fn height(self) -> T
Returns the height of the Rect.
§Examples
use geo_types::{coord, Rect};
let rect = Rect::new(
coord! { x: 5., y: 5. },
coord! { x: 15., y: 15. },
);
assert_eq!(rect.height(), 10.);Sourcepub fn to_polygon(self) -> Polygon<T>
pub fn to_polygon(self) -> Polygon<T>
Create a Polygon from the Rect.
§Examples
use geo_types::{coord, Rect, polygon};
let rect = Rect::new(
coord! { x: 0., y: 0. },
coord! { x: 1., y: 2. },
);
// Output is CCW
assert_eq!(
rect.to_polygon(),
polygon![
(x: 1., y: 0.),
(x: 1., y: 2.),
(x: 0., y: 2.),
(x: 0., y: 0.),
(x: 1., y: 0.),
],
);pub fn to_lines(&self) -> [Line<T>; 4]
Sourcepub fn split_x(self) -> [Rect<T>; 2]
pub fn split_x(self) -> [Rect<T>; 2]
Split a rectangle into two rectangles along the X-axis with equal widths.
§Examples
let rect = geo_types::Rect::new(
geo_types::coord! { x: 0., y: 0. },
geo_types::coord! { x: 4., y: 4. },
);
let [rect1, rect2] = rect.split_x();
assert_eq!(
geo_types::Rect::new(
geo_types::coord! { x: 0., y: 0. },
geo_types::coord! { x: 2., y: 4. },
),
rect1,
);
assert_eq!(
geo_types::Rect::new(
geo_types::coord! { x: 2., y: 0. },
geo_types::coord! { x: 4., y: 4. },
),
rect2,
);Sourcepub fn split_y(self) -> [Rect<T>; 2]
pub fn split_y(self) -> [Rect<T>; 2]
Split a rectangle into two rectangles along the Y-axis with equal heights.
§Examples
let rect = geo_types::Rect::new(
geo_types::coord! { x: 0., y: 0. },
geo_types::coord! { x: 4., y: 4. },
);
let [rect1, rect2] = rect.split_y();
assert_eq!(
geo_types::Rect::new(
geo_types::coord! { x: 0., y: 0. },
geo_types::coord! { x: 4., y: 2. },
),
rect1,
);
assert_eq!(
geo_types::Rect::new(
geo_types::coord! { x: 0., y: 2. },
geo_types::coord! { x: 4., y: 4. },
),
rect2,
);Trait Implementations§
Source§impl<T> AbsDiffEq for Rect<T>
impl<T> AbsDiffEq for Rect<T>
Source§fn abs_diff_eq(
&self,
other: &Rect<T>,
epsilon: <Rect<T> as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &Rect<T>, epsilon: <Rect<T> as AbsDiffEq>::Epsilon, ) -> bool
Equality assertion with an absolute limit.
§Examples
use geo_types::{point, Rect};
let a = Rect::new((0.0, 0.0), (10.0, 10.0));
let b = Rect::new((0.0, 0.0), (10.01, 10.0));
approx::abs_diff_eq!(a, b, epsilon=0.1);
approx::abs_diff_ne!(a, b, epsilon=0.001);Source§fn default_epsilon() -> <Rect<T> as AbsDiffEq>::Epsilon
fn default_epsilon() -> <Rect<T> as AbsDiffEq>::Epsilon
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl<T> Area<T> for Rect<T>where
T: CoordNum,
Because a Rect has no winding order, the area will always be positive.
impl<T> Area<T> for Rect<T>where
T: CoordNum,
Because a Rect has no winding order, the area will always be positive.
fn signed_area(&self) -> T
fn unsigned_area(&self) -> T
Source§impl<T> BoundingRect<T> for Rect<T>where
T: CoordNum,
impl<T> BoundingRect<T> for Rect<T>where
T: CoordNum,
Source§impl<F> Buffer for Rect<F>where
F: BoolOpsNum + 'static,
impl<F> Buffer for Rect<F>where
F: BoolOpsNum + 'static,
type Scalar = F
Source§fn buffer_with_style(
&self,
style: BufferStyle<<Rect<F> as Buffer>::Scalar>,
) -> MultiPolygon<<Rect<F> as Buffer>::Scalar>
fn buffer_with_style( &self, style: BufferStyle<<Rect<F> as Buffer>::Scalar>, ) -> MultiPolygon<<Rect<F> as Buffer>::Scalar>
Source§impl<T> Centroid for Rect<T>where
T: GeoFloat,
impl<T> Centroid for Rect<T>where
T: GeoFloat,
Source§impl<T> ChamberlainDuquetteArea<T> for Rect<T>where
T: CoordFloat,
impl<T> ChamberlainDuquetteArea<T> for Rect<T>where
T: CoordFloat,
fn chamberlain_duquette_signed_area(&self) -> T
fn chamberlain_duquette_unsigned_area(&self) -> T
Source§impl<F> ClosestPoint<F> for Rect<F>where
F: GeoFloat,
impl<F> ClosestPoint<F> for Rect<F>where
F: GeoFloat,
Source§fn closest_point(&self, p: &Point<F>) -> Closest<F>
fn closest_point(&self, p: &Point<F>) -> Closest<F>
self and p.Source§impl<T> Contains<GeometryCollection<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<GeometryCollection<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &GeometryCollection<T>) -> bool
Source§impl<T> Contains<LineString<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<LineString<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &LineString<T>) -> bool
Source§impl<T> Contains<MultiLineString<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiLineString<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiLineString<T>) -> bool
Source§impl<T> Contains<MultiPoint<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiPoint<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiPoint<T>) -> bool
Source§impl<T> Contains<MultiPolygon<T>> for Rect<T>where
T: GeoFloat,
impl<T> Contains<MultiPolygon<T>> for Rect<T>where
T: GeoFloat,
fn contains(&self, target: &MultiPolygon<T>) -> bool
Source§impl<T> CoordinatePosition for Rect<T>where
T: GeoNum,
impl<T> CoordinatePosition for Rect<T>where
T: GeoNum,
Source§impl<T> CoordsIter for Rect<T>where
T: CoordNum,
impl<T> CoordsIter for Rect<T>where
T: CoordNum,
Source§fn coords_iter(&self) -> <Rect<T> as CoordsIter>::Iter<'_>
fn coords_iter(&self) -> <Rect<T> as CoordsIter>::Iter<'_>
Iterates over the coordinates in CCW order
Source§fn coords_count(&self) -> usize
fn coords_count(&self) -> usize
Return the number of coordinates in the Rect.
Note: Although a Rect is represented by two coordinates, it is
spatially represented by four, so this method returns 4.
type Iter<'a> = Chain<Chain<Chain<Once<Coord<T>>, Once<Coord<T>>>, Once<Coord<T>>>, Once<Coord<T>>> where T: 'a
type ExteriorIter<'a> = <Rect<T> as CoordsIter>::Iter<'a> where T: 'a
type Scalar = T
Source§fn exterior_coords_iter(&self) -> <Rect<T> as CoordsIter>::ExteriorIter<'_>
fn exterior_coords_iter(&self) -> <Rect<T> as CoordsIter>::ExteriorIter<'_>
Source§impl<F> Densifiable<F> for Rect<F>where
F: CoordFloat + FromPrimitive,
impl<F> Densifiable<F> for Rect<F>where
F: CoordFloat + FromPrimitive,
Source§impl<T> DensifyHaversine<T> for Rect<T>where
T: CoordFloat + FromPrimitive,
Line<T>: HaversineLength<T>,
LineString<T>: HaversineLength<T>,
impl<T> DensifyHaversine<T> for Rect<T>where
T: CoordFloat + FromPrimitive,
Line<T>: HaversineLength<T>,
LineString<T>: HaversineLength<T>,
Source§type Output = Polygon<T>
type Output = Polygon<T>
Haversine.densify(&line) via the Densify trait instead.Source§fn densify_haversine(
&self,
max_distance: T,
) -> <Rect<T> as DensifyHaversine<T>>::Output
fn densify_haversine( &self, max_distance: T, ) -> <Rect<T> as DensifyHaversine<T>>::Output
Haversine.densify(&line) via the Densify trait instead.Source§impl<'de, T> Deserialize<'de> for Rect<T>where
T: CoordNum + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Rect<T>where
T: CoordNum + Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rect<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rect<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<T> EuclideanDistance<T> for Rect<T>
impl<T> EuclideanDistance<T> for Rect<T>
Source§fn euclidean_distance(&self, other: &Rect<T>) -> T
fn euclidean_distance(&self, other: &Rect<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, Geometry<T>> for Rect<T>
impl<T> EuclideanDistance<T, Geometry<T>> for Rect<T>
Source§fn euclidean_distance(&self, geom: &Geometry<T>) -> T
fn euclidean_distance(&self, geom: &Geometry<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, GeometryCollection<T>> for Rect<T>
impl<T> EuclideanDistance<T, GeometryCollection<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &GeometryCollection<T>) -> T
fn euclidean_distance(&self, other: &GeometryCollection<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, Line<T>> for Rect<T>
impl<T> EuclideanDistance<T, Line<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Line<T>) -> T
fn euclidean_distance(&self, other: &Line<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, LineString<T>> for Rect<T>
impl<T> EuclideanDistance<T, LineString<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &LineString<T>) -> T
fn euclidean_distance(&self, other: &LineString<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, MultiLineString<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiLineString<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiLineString<T>) -> T
fn euclidean_distance(&self, other: &MultiLineString<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, MultiPoint<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiPoint<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiPoint<T>) -> T
fn euclidean_distance(&self, other: &MultiPoint<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, MultiPolygon<T>> for Rect<T>
impl<T> EuclideanDistance<T, MultiPolygon<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &MultiPolygon<T>) -> T
fn euclidean_distance(&self, other: &MultiPolygon<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, Point<T>> for Rect<T>
impl<T> EuclideanDistance<T, Point<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Point<T>) -> T
fn euclidean_distance(&self, other: &Point<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, Polygon<T>> for Rect<T>
impl<T> EuclideanDistance<T, Polygon<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Polygon<T>) -> T
fn euclidean_distance(&self, other: &Polygon<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl<T> EuclideanDistance<T, Triangle<T>> for Rect<T>
impl<T> EuclideanDistance<T, Triangle<T>> for Rect<T>
Source§fn euclidean_distance(&self, other: &Triangle<T>) -> T
fn euclidean_distance(&self, other: &Triangle<T>) -> T
Euclidean.distance method from the Distance trait insteadSource§impl GeodesicArea<f64> for Rect
impl GeodesicArea<f64> for Rect
Source§fn geodesic_perimeter(&self) -> f64
fn geodesic_perimeter(&self) -> f64
Source§fn geodesic_area_signed(&self) -> f64
fn geodesic_area_signed(&self) -> f64
Source§fn geodesic_area_unsigned(&self) -> f64
fn geodesic_area_unsigned(&self) -> f64
Source§impl<C> HasDimensions for Rect<C>where
C: CoordNum,
impl<C> HasDimensions for Rect<C>where
C: CoordNum,
Source§fn dimensions(&self) -> Dimensions
fn dimensions(&self) -> Dimensions
Rects are 2-dimensional, but it’s possible to create degenerate Rects which
have either 1 or 0 dimensions. Read moreSource§fn boundary_dimensions(&self) -> Dimensions
fn boundary_dimensions(&self) -> Dimensions
Geometry’s boundary, as used by OGC-SFA. Read moreSource§impl<T> HaversineClosestPoint<T> for Rect<T>where
T: GeoFloat + FromPrimitive,
impl<T> HaversineClosestPoint<T> for Rect<T>where
T: GeoFloat + FromPrimitive,
fn haversine_closest_point(&self, from: &Point<T>) -> Closest<T>
Source§impl<T> InteriorPoint for Rect<T>where
T: GeoFloat,
impl<T> InteriorPoint for Rect<T>where
T: GeoFloat,
Source§impl<T> Intersects<Coord<T>> for Rect<T>where
T: CoordNum,
impl<T> Intersects<Coord<T>> for Rect<T>where
T: CoordNum,
fn intersects(&self, rhs: &Coord<T>) -> bool
Source§impl<T> Intersects<Geometry<T>> for Rect<T>
impl<T> Intersects<Geometry<T>> for Rect<T>
fn intersects(&self, rhs: &Geometry<T>) -> bool
Source§impl<T> Intersects<GeometryCollection<T>> for Rect<T>
impl<T> Intersects<GeometryCollection<T>> for Rect<T>
fn intersects(&self, rhs: &GeometryCollection<T>) -> bool
Source§impl<T> Intersects<Line<T>> for Rect<T>where
T: GeoNum,
impl<T> Intersects<Line<T>> for Rect<T>where
T: GeoNum,
fn intersects(&self, rhs: &Line<T>) -> bool
Source§impl<T> Intersects<LineString<T>> for Rect<T>
impl<T> Intersects<LineString<T>> for Rect<T>
fn intersects(&self, rhs: &LineString<T>) -> bool
Source§impl<T> Intersects<MultiLineString<T>> for Rect<T>
impl<T> Intersects<MultiLineString<T>> for Rect<T>
fn intersects(&self, rhs: &MultiLineString<T>) -> bool
Source§impl<T> Intersects<MultiPoint<T>> for Rect<T>
impl<T> Intersects<MultiPoint<T>> for Rect<T>
fn intersects(&self, rhs: &MultiPoint<T>) -> bool
Source§impl<T> Intersects<MultiPolygon<T>> for Rect<T>
impl<T> Intersects<MultiPolygon<T>> for Rect<T>
fn intersects(&self, rhs: &MultiPolygon<T>) -> bool
Source§impl<T> Intersects<Point<T>> for Rect<T>
impl<T> Intersects<Point<T>> for Rect<T>
fn intersects(&self, rhs: &Point<T>) -> bool
Source§impl<T> Intersects<Polygon<T>> for Rect<T>
impl<T> Intersects<Polygon<T>> for Rect<T>
fn intersects(&self, rhs: &Polygon<T>) -> bool
Source§impl<T> Intersects<Triangle<T>> for Rect<T>where
T: GeoNum,
impl<T> Intersects<Triangle<T>> for Rect<T>where
T: GeoNum,
fn intersects(&self, rhs: &Triangle<T>) -> bool
Source§impl<T> Intersects for Rect<T>where
T: CoordNum,
impl<T> Intersects for Rect<T>where
T: CoordNum,
fn intersects(&self, other: &Rect<T>) -> bool
Source§impl<T, NT> MapCoords<T, NT> for Rect<T>
impl<T, NT> MapCoords<T, NT> for Rect<T>
Source§impl<T> MapCoordsInPlace<T> for Rect<T>where
T: CoordNum,
impl<T> MapCoordsInPlace<T> for Rect<T>where
T: CoordNum,
Source§impl<F> Relate<F> for Rect<F>where
F: GeoFloat,
impl<F> Relate<F> for Rect<F>where
F: GeoFloat,
Source§fn geometry_graph(&self, arg_index: usize) -> GeometryGraph<'_, F>
fn geometry_graph(&self, arg_index: usize) -> GeometryGraph<'_, F>
fn relate(&self, other: &impl Relate<F>) -> IntersectionMatrixwhere
Self: Sized,
Source§impl<T> RelativeEq for Rect<T>where
T: CoordNum + RelativeEq<Epsilon = T>,
impl<T> RelativeEq for Rect<T>where
T: CoordNum + RelativeEq<Epsilon = T>,
Source§fn relative_eq(
&self,
other: &Rect<T>,
epsilon: <Rect<T> as AbsDiffEq>::Epsilon,
max_relative: <Rect<T> as AbsDiffEq>::Epsilon,
) -> bool
fn relative_eq( &self, other: &Rect<T>, epsilon: <Rect<T> as AbsDiffEq>::Epsilon, max_relative: <Rect<T> as AbsDiffEq>::Epsilon, ) -> bool
Equality assertion within a relative limit.
§Examples
use geo_types::Rect;
let a = Rect::new((0.0, 0.0), (10.0, 10.0));
let b = Rect::new((0.0, 0.0), (10.01, 10.0));
approx::assert_relative_eq!(a, b, max_relative=0.1);
approx::assert_relative_ne!(a, b, max_relative=0.0001);Source§fn default_max_relative() -> <Rect<T> as AbsDiffEq>::Epsilon
fn default_max_relative() -> <Rect<T> as AbsDiffEq>::Epsilon
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq.Source§impl<T> RemoveRepeatedPoints<T> for Rect<T>where
T: CoordNum,
impl<T> RemoveRepeatedPoints<T> for Rect<T>where
T: CoordNum,
Source§fn remove_repeated_points(&self) -> Rect<T>
fn remove_repeated_points(&self) -> Rect<T>
Source§fn remove_repeated_points_mut(&mut self)
fn remove_repeated_points_mut(&mut self)
Source§impl<T> Serialize for Rect<T>
impl<T> Serialize for Rect<T>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<T> TryFrom<Geometry<T>> for Rect<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
impl<T> TryFrom<Geometry<T>> for Rect<T>where
T: CoordNum,
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Source§impl<T> UlpsEq for Rect<T>
impl<T> UlpsEq for Rect<T>
Source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
Source§impl<F> Validation for Rect<F>where
F: GeoFloat,
impl<F> Validation for Rect<F>where
F: GeoFloat,
type Error = InvalidRect
Source§fn visit_validation<T>(
&self,
handle_validation_error: Box<dyn FnMut(<Rect<F> as Validation>::Error) -> Result<(), T> + '_>,
) -> Result<(), T>
fn visit_validation<T>( &self, handle_validation_error: Box<dyn FnMut(<Rect<F> as Validation>::Error) -> Result<(), T> + '_>, ) -> Result<(), T>
impl<T> Copy for Rect<T>
impl<T> Eq for Rect<T>
impl<T> StructuralPartialEq for Rect<T>where
T: CoordNum,
Auto Trait Implementations§
impl<T> Freeze for Rect<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rect<T>where
T: RefUnwindSafe,
impl<T> Send for Rect<T>where
T: Send,
impl<T> Sync for Rect<T>where
T: Sync,
impl<T> Unpin for Rect<T>where
T: Unpin,
impl<T> UnwindSafe for Rect<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T, M> AffineOps<T> for M
impl<T, M> AffineOps<T> for M
Source§fn affine_transform(&self, transform: &AffineTransform<T>) -> M
fn affine_transform(&self, transform: &AffineTransform<T>) -> M
transform immutably, outputting a new geometry.Source§fn affine_transform_mut(&mut self, transform: &AffineTransform<T>)
fn affine_transform_mut(&mut self, transform: &AffineTransform<T>)
transform to mutate self.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T, G> ConvexHull<'a, T> for Gwhere
T: GeoNum,
G: CoordsIter<Scalar = T>,
impl<'a, T, G> ConvexHull<'a, T> for Gwhere
T: GeoNum,
G: CoordsIter<Scalar = T>,
Source§impl<'a, T, G> Extremes<'a, T> for Gwhere
G: CoordsIter<Scalar = T>,
T: CoordNum,
impl<'a, T, G> Extremes<'a, T> for Gwhere
G: CoordsIter<Scalar = T>,
T: CoordNum,
Source§impl<T, G> HausdorffDistance<T> for Gwhere
T: GeoFloat,
G: CoordsIter<Scalar = T>,
impl<T, G> HausdorffDistance<T> for Gwhere
T: GeoFloat,
G: CoordsIter<Scalar = T>,
fn hausdorff_distance<Rhs>(&self, rhs: &Rhs) -> Twhere
Rhs: CoordsIter<Scalar = T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, G> MinimumRotatedRect<T> for G
impl<T, G> MinimumRotatedRect<T> for G
type Scalar = T
fn minimum_rotated_rect( &self, ) -> Option<Polygon<<G as MinimumRotatedRect<T>>::Scalar>>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<G, IP, IR, T> Rotate<T> for G
impl<G, IP, IR, T> Rotate<T> for G
Source§fn rotate_around_centroid(&self, degrees: T) -> G
fn rotate_around_centroid(&self, degrees: T) -> G
Source§fn rotate_around_centroid_mut(&mut self, degrees: T)
fn rotate_around_centroid_mut(&mut self, degrees: T)
Self::rotate_around_centroidSource§fn rotate_around_center(&self, degrees: T) -> G
fn rotate_around_center(&self, degrees: T) -> G
Source§fn rotate_around_center_mut(&mut self, degrees: T)
fn rotate_around_center_mut(&mut self, degrees: T)
Self::rotate_around_centerSource§fn rotate_around_point(&self, degrees: T, point: Point<T>) -> G
fn rotate_around_point(&self, degrees: T, point: Point<T>) -> G
Source§fn rotate_around_point_mut(&mut self, degrees: T, point: Point<T>)
fn rotate_around_point_mut(&mut self, degrees: T, point: Point<T>)
Self::rotate_around_pointSource§impl<T, IR, G> Scale<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
impl<T, IR, G> Scale<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
Source§fn scale(&self, scale_factor: T) -> G
fn scale(&self, scale_factor: T) -> G
Source§fn scale_xy(&self, x_factor: T, y_factor: T) -> G
fn scale_xy(&self, x_factor: T, y_factor: T) -> G
x_factor and
y_factor to distort the geometry’s aspect ratio. Read moreSource§fn scale_xy_mut(&mut self, x_factor: T, y_factor: T)
fn scale_xy_mut(&mut self, x_factor: T, y_factor: T)
scale_xy.Source§fn scale_around_point(
&self,
x_factor: T,
y_factor: T,
origin: impl Into<Coord<T>>,
) -> G
fn scale_around_point( &self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>>, ) -> G
origin. Read moreSource§fn scale_around_point_mut(
&mut self,
x_factor: T,
y_factor: T,
origin: impl Into<Coord<T>>,
)
fn scale_around_point_mut( &mut self, x_factor: T, y_factor: T, origin: impl Into<Coord<T>>, )
scale_around_point.Source§impl<T, IR, G> Skew<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
impl<T, IR, G> Skew<T> for Gwhere
T: CoordFloat,
IR: Into<Option<Rect<T>>>,
G: Clone + AffineOps<T> + BoundingRect<T, Output = IR>,
Source§fn skew(&self, degrees: T) -> G
fn skew(&self, degrees: T) -> G
Source§fn skew_xy(&self, degrees_x: T, degrees_y: T) -> G
fn skew_xy(&self, degrees_x: T, degrees_y: T) -> G
Source§fn skew_xy_mut(&mut self, degrees_x: T, degrees_y: T)
fn skew_xy_mut(&mut self, degrees_x: T, degrees_y: T)
skew_xy.Source§fn skew_around_point(&self, xs: T, ys: T, origin: impl Into<Coord<T>>) -> G
fn skew_around_point(&self, xs: T, ys: T, origin: impl Into<Coord<T>>) -> G
origin, sheared by an
angle along the x and y dimensions. Read moreSource§fn skew_around_point_mut(&mut self, xs: T, ys: T, origin: impl Into<Coord<T>>)
fn skew_around_point_mut(&mut self, xs: T, ys: T, origin: impl Into<Coord<T>>)
skew_around_point.Source§impl<T, G> ToDegrees<T> for G
impl<T, G> ToDegrees<T> for G
fn to_degrees(&self) -> Self
fn to_degrees_in_place(&mut self)
Source§impl<T, G> ToRadians<T> for G
impl<T, G> ToRadians<T> for G
fn to_radians(&self) -> Self
fn to_radians_in_place(&mut self)
Source§impl<'a, T, G> TriangulateDelaunay<'a, T> for Gwhere
T: SpadeTriangulationFloat,
G: TriangulationRequirementTrait<'a, T>,
impl<'a, T, G> TriangulateDelaunay<'a, T> for Gwhere
T: SpadeTriangulationFloat,
G: TriangulationRequirementTrait<'a, T>,
Source§fn unconstrained_triangulation(
&'a self,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn unconstrained_triangulation( &'a self, ) -> Result<Vec<Triangle<T>>, TriangulationError>
Source§fn constrained_outer_triangulation(
&'a self,
config: DelaunayTriangulationConfig<T>,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn constrained_outer_triangulation( &'a self, config: DelaunayTriangulationConfig<T>, ) -> Result<Vec<Triangle<T>>, TriangulationError>
Source§fn constrained_triangulation(
&'a self,
config: DelaunayTriangulationConfig<T>,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn constrained_triangulation( &'a self, config: DelaunayTriangulationConfig<T>, ) -> Result<Vec<Triangle<T>>, TriangulationError>
Source§impl<'a, T, G> TriangulateSpade<'a, T> for Gwhere
T: SpadeTriangulationFloat,
G: TriangulationRequirementTrait<'a, T>,
impl<'a, T, G> TriangulateSpade<'a, T> for Gwhere
T: SpadeTriangulationFloat,
G: TriangulationRequirementTrait<'a, T>,
Source§fn unconstrained_triangulation(
&'a self,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn unconstrained_triangulation( &'a self, ) -> Result<Vec<Triangle<T>>, TriangulationError>
triangulate_delaunay module insteadSource§fn constrained_outer_triangulation(
&'a self,
config: SpadeTriangulationConfig<T>,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn constrained_outer_triangulation( &'a self, config: SpadeTriangulationConfig<T>, ) -> Result<Vec<Triangle<T>>, TriangulationError>
triangulate_delaunay module insteadSource§fn constrained_triangulation(
&'a self,
config: SpadeTriangulationConfig<T>,
) -> Result<Vec<Triangle<T>>, TriangulationError>
fn constrained_triangulation( &'a self, config: SpadeTriangulationConfig<T>, ) -> Result<Vec<Triangle<T>>, TriangulationError>
triangulate_delaunay module instead