Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
81f6a405cf | |||
522f9f6668 | |||
d02df2f83e | |||
ed78807a9f | |||
b419f2a321 | |||
92e333fcbe |
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -22,8 +22,9 @@ checksum = "50202def95bf36cb7d1d7a7962cea1c36a3f8ad42425e5d2b71d7acb8041b5b8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixed_wide"
|
name = "fixed_wide"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
|
checksum = "d9c2cf115b3785ede870fada07e8b1aeba3378345b4ca86fe3c772ecabc05c0f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bnum",
|
"bnum",
|
||||||
@ -33,9 +34,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glam"
|
name = "glam"
|
||||||
version = "0.28.0"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94"
|
checksum = "c28091a37a5d09b555cb6628fd954da299b536433834f5b8e59eba78e0cbbf8a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "id"
|
name = "id"
|
||||||
@ -51,7 +52,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "linear_ops"
|
name = "linear_ops"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
|
checksum = "b2e6977ac24f47086d8a7a2d4ae1c720e86dfdc8407cf5e34c18bfa01053c456"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fixed_wide",
|
"fixed_wide",
|
||||||
"paste",
|
"paste",
|
||||||
@ -75,9 +77,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.36"
|
version = "1.0.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@ -85,11 +87,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ratio_ops"
|
name = "ratio_ops"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
|
checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_common"
|
name = "strafesnet_common"
|
||||||
version = "0.4.1"
|
version = "0.5.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -102,9 +105,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.72"
|
version = "2.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
|
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -113,6 +116,6 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.12"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||||
|
10
Cargo.toml
10
Cargo.toml
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "strafesnet_common"
|
name = "strafesnet_common"
|
||||||
version = "0.4.1"
|
version = "0.5.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://git.itzana.me/StrafesNET/common"
|
repository = "https://git.itzana.me/StrafesNET/common"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
@ -12,8 +12,8 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
arrayvec = "0.7.4"
|
arrayvec = "0.7.4"
|
||||||
bitflags = "2.6.0"
|
bitflags = "2.6.0"
|
||||||
fixed_wide = { git = "https://git.itzana.me/StrafesNET/fixed_wide_vectors", rev = "438d0ec6ec4ae97d13d950ea317ce324dd205e10", features = ["deferred-division","zeroes","wide-mul"] }
|
fixed_wide = { version = "0.1.1", registry = "strafesnet", features = ["deferred-division","zeroes","wide-mul"] }
|
||||||
linear_ops = { git = "https://git.itzana.me/StrafesNET/fixed_wide_vectors", rev = "438d0ec6ec4ae97d13d950ea317ce324dd205e10", features = ["deferred-division","named-fields"] }
|
linear_ops = { version = "0.1.0", registry = "strafesnet", features = ["deferred-division","named-fields"] }
|
||||||
ratio_ops = { git = "https://git.itzana.me/StrafesNET/fixed_wide_vectors", rev = "438d0ec6ec4ae97d13d950ea317ce324dd205e10" }
|
ratio_ops = { version = "0.1.0", registry = "strafesnet" }
|
||||||
glam = "0.28.0"
|
glam = "0.29.0"
|
||||||
id = { version = "0.1.0", registry = "strafesnet" }
|
id = { version = "0.1.0", registry = "strafesnet" }
|
||||||
|
@ -525,6 +525,7 @@ impl TryFrom<[f32;3]> for Unit32Vec3{
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pub type Planar64TryFromFloatError=fixed_wide::fixed::FixedFromFloatError;
|
||||||
pub type Planar64=fixed_wide::types::I32F32;
|
pub type Planar64=fixed_wide::types::I32F32;
|
||||||
pub type Planar64Vec3=linear_ops::types::Vector3<Planar64>;
|
pub type Planar64Vec3=linear_ops::types::Vector3<Planar64>;
|
||||||
pub type Planar64Mat3=linear_ops::types::Matrix3<Planar64>;
|
pub type Planar64Mat3=linear_ops::types::Matrix3<Planar64>;
|
||||||
@ -543,23 +544,52 @@ pub mod vec3{
|
|||||||
pub const NEG_Y:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::NEG_ONE,Planar64::ZERO]);
|
pub const NEG_Y:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::NEG_ONE,Planar64::ZERO]);
|
||||||
pub const NEG_Z:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::ZERO,Planar64::NEG_ONE]);
|
pub const NEG_Z:Planar64Vec3=Planar64Vec3::new([Planar64::ZERO,Planar64::ZERO,Planar64::NEG_ONE]);
|
||||||
pub const NEG_ONE:Planar64Vec3=Planar64Vec3::new([Planar64::NEG_ONE,Planar64::NEG_ONE,Planar64::NEG_ONE]);
|
pub const NEG_ONE:Planar64Vec3=Planar64Vec3::new([Planar64::NEG_ONE,Planar64::NEG_ONE,Planar64::NEG_ONE]);
|
||||||
pub fn int(x:i32,y:i32,z:i32)->Planar64Vec3{
|
#[inline]
|
||||||
Planar64Vec3::new([Planar64::from(x),Planar64::from(y),Planar64::from(z)])
|
pub const fn int(x:i32,y:i32,z:i32)->Planar64Vec3{
|
||||||
|
Planar64Vec3::new([Planar64::raw((x as i64)<<32),Planar64::raw((y as i64)<<32),Planar64::raw((z as i64)<<32)])
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub fn raw_array(array:[i64;3])->Planar64Vec3{
|
pub fn raw_array(array:[i64;3])->Planar64Vec3{
|
||||||
Planar64Vec3::new(array.map(Planar64::raw))
|
Planar64Vec3::new(array.map(Planar64::raw))
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub fn raw_xyz(x:i64,y:i64,z:i64)->Planar64Vec3{
|
pub fn raw_xyz(x:i64,y:i64,z:i64)->Planar64Vec3{
|
||||||
Planar64Vec3::new([Planar64::raw(x),Planar64::raw(y),Planar64::raw(z)])
|
Planar64Vec3::new([Planar64::raw(x),Planar64::raw(y),Planar64::raw(z)])
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
pub fn try_from_f32_array([x,y,z]:[f32;3])->Result<Planar64Vec3,Planar64TryFromFloatError>{
|
||||||
|
Ok(Planar64Vec3::new([
|
||||||
|
try_from_f32(x)?,
|
||||||
|
try_from_f32(y)?,
|
||||||
|
try_from_f32(z)?,
|
||||||
|
]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn int(value:i32)->Planar64{
|
pub fn int(value:i32)->Planar64{
|
||||||
Planar64::from(value)
|
Planar64::from(value)
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
pub fn try_from_f32(value:f32)->Result<Planar64,Planar64TryFromFloatError>{
|
||||||
|
let result:Result<Planar64,_>=value.try_into();
|
||||||
|
match result{
|
||||||
|
Ok(ok)=>Ok(ok),
|
||||||
|
Err(e)=>e.underflow_to_zero(),
|
||||||
|
}
|
||||||
|
}
|
||||||
pub mod mat3{
|
pub mod mat3{
|
||||||
use super::*;
|
use super::*;
|
||||||
pub use linear_ops::types::Matrix3;
|
pub use linear_ops::types::Matrix3;
|
||||||
|
#[inline]
|
||||||
|
pub const fn identity()->Planar64Mat3{
|
||||||
|
Planar64Mat3::new([
|
||||||
|
[Planar64::ONE,Planar64::ZERO,Planar64::ZERO],
|
||||||
|
[Planar64::ZERO,Planar64::ONE,Planar64::ZERO],
|
||||||
|
[Planar64::ZERO,Planar64::ZERO,Planar64::ONE],
|
||||||
|
])
|
||||||
|
}
|
||||||
|
#[inline]
|
||||||
pub fn from_diagonal(diag:Planar64Vec3)->Planar64Mat3{
|
pub fn from_diagonal(diag:Planar64Vec3)->Planar64Mat3{
|
||||||
Planar64Mat3::new([
|
Planar64Mat3::new([
|
||||||
[diag.x,Planar64::ZERO,Planar64::ZERO],
|
[diag.x,Planar64::ZERO,Planar64::ZERO],
|
||||||
@ -586,6 +616,14 @@ pub mod mat3{
|
|||||||
Planar64Vec3::new([s,Planar64::ZERO,c]),
|
Planar64Vec3::new([s,Planar64::ZERO,c]),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
pub fn try_from_f32_array_2d([x_axis,y_axis,z_axis]:[[f32;3];3])->Result<Planar64Mat3,Planar64TryFromFloatError>{
|
||||||
|
Ok(Planar64Mat3::new([
|
||||||
|
vec3::try_from_f32_array(x_axis)?.to_array(),
|
||||||
|
vec3::try_from_f32_array(y_axis)?.to_array(),
|
||||||
|
vec3::try_from_f32_array(z_axis)?.to_array(),
|
||||||
|
]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone,Copy,Default,Hash,Eq,PartialEq)]
|
#[derive(Clone,Copy,Default,Hash,Eq,PartialEq)]
|
||||||
|
Loading…
Reference in New Issue
Block a user