Fix multiple warnings.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::dynamics::MassProperties;
|
||||
use crate::math::Point;
|
||||
#[cfg(feature = "dim3")]
|
||||
use crate::{geometry::Capsule, math::Rotation};
|
||||
use crate::geometry::Capsule;
|
||||
use crate::math::Point;
|
||||
|
||||
impl MassProperties {
|
||||
pub(crate) fn from_capsule(density: f32, a: Point<f32>, b: Point<f32>, radius: f32) -> Self {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::dynamics::MassProperties;
|
||||
use crate::geometry::Cone;
|
||||
use crate::math::{Point, PrincipalAngularInertia, Rotation, Vector};
|
||||
|
||||
impl MassProperties {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use crate::dynamics::MassProperties;
|
||||
use crate::math::{PrincipalAngularInertia, Vector};
|
||||
#[cfg(feature = "dim3")]
|
||||
use {
|
||||
crate::geometry::Capsule,
|
||||
crate::math::{Point, Rotation},
|
||||
};
|
||||
use crate::math::{Point, Rotation};
|
||||
use crate::math::{PrincipalAngularInertia, Vector};
|
||||
|
||||
impl MassProperties {
|
||||
pub(crate) fn cylinder_y_volume_unit_inertia(
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::geometry::{
|
||||
Segment, Shape, ShapeType, Triangle, Trimesh,
|
||||
};
|
||||
#[cfg(feature = "dim3")]
|
||||
use crate::geometry::{Cone, Cylinder, PolygonalFeatureMap, Rounded};
|
||||
use crate::geometry::{Cone, Cylinder, Rounded};
|
||||
use crate::math::{AngVector, Isometry, Point, Rotation, Vector};
|
||||
use na::Point3;
|
||||
use ncollide::bounding_volume::AABB;
|
||||
|
||||
@@ -5,8 +5,6 @@ use crate::geometry::contact_generator::{
|
||||
use crate::geometry::Capsule;
|
||||
use crate::geometry::{Collider, ContactManifold, HeightField, Shape, ShapeType};
|
||||
use crate::ncollide::bounding_volume::BoundingVolume;
|
||||
#[cfg(feature = "dim3")]
|
||||
use crate::{geometry::Triangle, math::Point};
|
||||
use std::any::Any;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
@@ -111,7 +109,7 @@ fn do_generate_contacts(
|
||||
heightfield1.map_elements_in_local_aabb(&ls_aabb2, &mut |i, part1, _| {
|
||||
let position1 = collider1.position();
|
||||
#[cfg(feature = "dim2")]
|
||||
let sub_shape1 = Capsule::new(part1.a, part1.b, 0.0);
|
||||
let sub_shape1 = Capsule::new(part1.a, part1.b, 0.0); // TODO: use a segment instead.
|
||||
#[cfg(feature = "dim3")]
|
||||
let sub_shape1 = *part1;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use crate::geometry::contact_generator::PrimitiveContactGenerationContext;
|
||||
use crate::geometry::{
|
||||
Contact, ContactManifold, KinematicsCategory, PolygonalFeatureMap, PolyhedronFace,
|
||||
};
|
||||
use crate::geometry::{KinematicsCategory, PolygonalFeatureMap, PolyhedronFace};
|
||||
use crate::math::{Isometry, Vector};
|
||||
use crate::na::UnitQuaternion;
|
||||
use na::Unit;
|
||||
use ncollide::query;
|
||||
use ncollide::query::algorithms::{gjk::GJKResult, VoronoiSimplex};
|
||||
@@ -11,7 +8,6 @@ use ncollide::query::algorithms::{gjk::GJKResult, VoronoiSimplex};
|
||||
pub struct PfmPfmContactManifoldGeneratorWorkspace {
|
||||
simplex: VoronoiSimplex<f32>,
|
||||
last_gjk_dir: Option<Unit<Vector<f32>>>,
|
||||
last_optimal_dir: Option<Unit<Vector<f32>>>,
|
||||
feature1: PolyhedronFace,
|
||||
feature2: PolyhedronFace,
|
||||
}
|
||||
@@ -21,7 +17,6 @@ impl Default for PfmPfmContactManifoldGeneratorWorkspace {
|
||||
Self {
|
||||
simplex: VoronoiSimplex::new(),
|
||||
last_gjk_dir: None,
|
||||
last_optimal_dir: None,
|
||||
feature1: PolyhedronFace::new(),
|
||||
feature2: PolyhedronFace::new(),
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(dead_code)] // TODO: remove this once we support polygons.
|
||||
|
||||
use crate::geometry::contact_generator::PrimitiveContactGenerationContext;
|
||||
use crate::geometry::{sat, Contact, ContactManifold, KinematicsCategory, Polygon};
|
||||
use crate::math::{Isometry, Point};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(dead_code)] // TODO: remove this once we support polygons.
|
||||
|
||||
use crate::math::{Isometry, Point, Vector};
|
||||
use ncollide::bounding_volume::AABB;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::geometry::proximity_detector::PrimitiveProximityDetectionContext;
|
||||
use crate::geometry::{sat, Polygon, Proximity};
|
||||
use crate::math::Isometry;
|
||||
|
||||
@@ -4,6 +4,7 @@ use crate::utils::WSign;
|
||||
use na::Unit;
|
||||
use ncollide::shape::{Segment, SupportMap};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn polygon_polygon_compute_separation_features(
|
||||
p1: &Polygon,
|
||||
p2: &Polygon,
|
||||
|
||||
26
src/utils.rs
26
src/utils.rs
@@ -1,7 +1,6 @@
|
||||
//! Miscellaneous utilities.
|
||||
|
||||
use crate::dynamics::RigidBodyHandle;
|
||||
use crate::math::{Isometry, Point, Rotation, Vector};
|
||||
#[cfg(all(feature = "enhanced-determinism", feature = "serde-serialize"))]
|
||||
use indexmap::IndexMap as HashMap;
|
||||
use na::{Matrix2, Matrix3, Matrix3x2, Point2, Point3, Scalar, SimdRealField, Vector2, Vector3};
|
||||
@@ -1334,28 +1333,3 @@ pub(crate) fn other_handle(
|
||||
pair.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the rotation that aligns the y axis to the segment direction.
|
||||
pub(crate) fn rotation_wrt_y(a: &Point<f32>, b: &Point<f32>) -> Rotation<f32> {
|
||||
let mut dir = b - a;
|
||||
|
||||
if dir.y < 0.0 {
|
||||
dir = -dir;
|
||||
}
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
return Rotation::rotation_between(&Vector::y(), &dir);
|
||||
|
||||
#[cfg(feature = "dim3")]
|
||||
return Rotation::rotation_between(&Vector::y(), &dir).unwrap_or(Rotation::identity());
|
||||
}
|
||||
|
||||
// Return the transform that aligns the y axis to the segment and move the origin to the segment middle,
|
||||
// and the capsule's half-height.
|
||||
pub(crate) fn segment_to_capsule(a: &Point<f32>, b: &Point<f32>) -> (Isometry<f32>, f32) {
|
||||
let rot = rotation_wrt_y(a, b);
|
||||
let half_height = (b - a).norm() / 2.0;
|
||||
let center = na::center(a, b);
|
||||
let pos = Isometry::from_parts(center.coords.into(), rot);
|
||||
(pos, half_height)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user