by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 12 21:55
    josh65536 commented #499
  • Aug 12 21:46
    kvark commented #499
  • Aug 12 21:22
    josh65536 commented #499
  • Aug 12 21:20
    josh65536 commented #499
  • Aug 12 20:05
    kvark commented #499
  • Aug 12 19:32
    josh65536 commented #499
  • Aug 12 19:05

    kvark on master

    Now there is only one one (#513… (compare)

  • Aug 12 19:05
    kvark closed #513
  • Aug 12 19:04
    kvark commented #499
  • Aug 12 15:03
    josh65536 commented #499
  • Aug 12 15:02
    josh65536 synchronize #513
  • Aug 12 03:04

    kvark on master

    Fixed opposite quaternion slerp… (compare)

  • Aug 12 03:04
    kvark closed #515
  • Aug 12 03:04
    kvark closed #498
  • Aug 12 01:08
    josh65536 commented #515
  • Aug 11 22:19
    aloucks commented #515
  • Aug 11 21:50
    aloucks commented #515
  • Aug 11 19:35
    josh65536 synchronize #515
  • Aug 11 16:23
    josh65536 commented #515
  • Aug 11 16:13
    josh65536 synchronize #515
刘雨培
@LYP951018
↑My TexedShape
Luke Frisken
@kellpossible
@brendanzab hi! nice too meet you last night at the rust meetup!
Looks like someone started trying to make an issue aggregator, not sure if they completed it? https://github.com/dsyer/issue-aggregator
Defcronyke
@defcronyke

Hey, I have a question about using quaternions correctly, which I just asked in the the vulkano-rs/Lobby room...
Can someone tell me if I'm using cgmath correctly for this quaternion? It does rotate the scene, but as it approaches 90-180 degrees rotation in either direction, the scene stretches out and warps into garbage, and I don't know why.

let rotation_scalar = (rotation_angle / 2.0 as f32).cos();
let rotation_vec = Vector3::new(
    rotation_axis.x * (rotation_angle / 2.0 as f32).sin(),
    rotation_axis.y * (rotation_angle / 2.0 as f32).sin(),
    rotation_axis.z * (rotation_angle / 2.0 as f32).sin());
let mut rotation_quat = Quaternion::from_sv(rotation_scalar, rotation_vec);

that's the initial quaternion, and then to rotate it when the mouse moves, I'm doing this:

let diff_x = position.0 - last_x;
if diff_x > 0.0 {
    // println!("turn right");
    rotation_quat.v.x += rotation_axis.x * ((rotation_angle + rotation_speed) / 2.0 as f32).sin();
    rotation_quat.v.y += rotation_axis.y * ((rotation_angle + rotation_speed) / 2.0 as f32).sin();
    rotation_quat.v.z += rotation_axis.z * ((rotation_angle + rotation_speed) / 2.0 as f32).sin();
    rotation_quat.s += ((rotation_angle + rotation_speed) / 2.0 as f32).cos()
} else if diff_x < 0.0 {
    // println!("turn left");
    rotation_quat.v.x += rotation_axis.x * ((rotation_angle - rotation_speed) / 2.0 as f32).sin();
    rotation_quat.v.y += rotation_axis.y * ((rotation_angle - rotation_speed) / 2.0 as f32).sin();
    rotation_quat.v.z += rotation_axis.z * ((rotation_angle - rotation_speed) / 2.0 as f32).sin();
    rotation_quat.s += ((rotation_angle - rotation_speed) / 2.0 as f32).cos()
}

last_x = position.0;

(rotation_speed is some value in radians, like 0.1 or something)
I haven't used quaternions before, but I wrote it according to a formula I found here: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/
my understanding is if you specify the data as a quaternion, it won't suffer problems of euclidean rotations, but then you have to turn the quaternion into a matrix to multiply it with the translation matrix, to apply the rotation

let rot_mat = Matrix4::from(rotation_quat);

to get the final orientation of the scene, I'm multiplying the matrices like this:

proj * view * trans_mat * rot_mat
Defcronyke
@defcronyke
Defcronyke
@defcronyke
nvm, problem solved
Osspial
@Osspial
@brendanzab Hi! Would it be possible to push the newest changes to crates.io as v0.17? I'm planning on releasing a bunch of crates today on crates.io that rely on the new features.
Right now, I'm re-exporting the new changes here, but I'd rather be able to use the actual version on crates.io
Brendan Zabarauskas
@brendanzab
@Osspial publishing right now!
sorry for the lateness
Osspial
@Osspial
It's fine, I've been doing release polishing all day and wouldn't have been able to release earlier than this anyways
thanks for releasing!
Brendan Zabarauskas
@brendanzab
Wondering if we should spend time figuring out the governance around cgmath, seeing as I'm obviously slipping in my role as a maintainer.
Cool to see some work on geometry stuff anyway!
Osspial
@Osspial
you're doing fine - I don't think cgmath is in a state where all that much work needs to be done on it, anyway.
and yeah, I started work on the geometry stuff mainly because I was really sick of re-defining rectangle types everywhere
Brendan Zabarauskas
@brendanzab
Yeah, keeping up with issues is always a pain. And I know there are still rough edges. Also frustrates me that while cgmath is usable, it's super messy internally :(
There are a number of things I was planning to look at by the way, but havn't hads a chance to atm:
  • Adding inherent methods as alternatives to going via traits. These would just call the trait implementations, but they would still be available for generic programming. This would make it more accessible for users who don't yet need to get their heads around abstract algebra.
  • Figuring out what it would take to integrate with @sebcrozet's https://github.com/sebcrozet/alga API, and whether we need to demand some upstream changes to that to make the API more friendly
  • Better docs
  • More tests
  • Thinking about coordinate systems - Vulkan vs. DirectX, vs. Metal vs. OpenGL - some of the functions make assumptions about the base coordinate system that is not reflected in the types
Brendan Zabarauskas
@brendanzab
Also need to collaborate with the Amethyst folks more closely
Perhaps automating the deployment infrastructure would be handy too - not really sure how to do that though :/
@Osspial would be curious if the geometry stuff would be handy for the Amethyst folks
Osspial
@Osspial
probably at some point, but I really need to flesh it out more. Right now the only thing in it that I'm really happy with is the rectangle code
Brendan Zabarauskas
@brendanzab
:D
Osspial
@Osspial
I'm planning on adding support for planes next, but the main thing I'm using this for rn is UI stuff and 3D primitives aren't necessary for that
also, that alga crate looks pretty cool. Didn't know it existed.
Brendan Zabarauskas
@brendanzab
Also want to tackle the transform API again, but I remember the traits were exploding in weird ways, ddunno if I need to wait for https://gitter.im/rust-lang/WG-traits to do more work on cleaning up the trait constraint solver :/
Yeah, the alga trait is neat - it grew out of my desire to have some generic abstract algebraic traits for Rust - I feel like the API could be iterated on to make it more understandable to the mere mortal, but it's heading in the right direction. But we're kind of letting down the team by not integrating with it!
#447 also mentioned more general traits that could work with Geometric algebra, which is a neat idea
Ram
@quadrupleslap
(i already opened an issue for this) would a pr adding display to all the vector types be accepted?
Brendan Zabarauskas
@brendanzab
Probably! What were your use cases though?
Ram
@quadrupleslap
i want to log region loading errors to players, and the options are:
  • use debug and show the class name too
  • make a formatting function
  • add a display impl
Brendan Zabarauskas
@brendanzab
Yeah - tricky thing about the Display impl is it can be pretty context-dependent. Sometimes it's better to make a custom wrapper struct (with its domain-specific impl of Display) that you only use when making other Display implementations. We could however improve the debug output..?
This is kinda what got me thinking when I first read your issue, then couldn't decide how to respond, then actually forgot to respond. :sweat_smile:
(sorry, as always, terrible maintainer is me)
Ram
@quadrupleslap
(copied off github) How about modifying the "pretty" Debug output (the one with the # modifier)? Removing the class name from the default debug output might make debugging harder.
Björn Wieczoreck
@_TurboFish_gitlab

Hey, I've been running into an issue with cgmath. I simply want to transform a vector and a point using a matrix, but I am getting this error.

error[E0284]: type annotations required: cannot resolve `<_ as cgmath::EuclideanSpace>::Diff == cgmath::Vector3<f64>`
  --> gst-geometryhelper/src/types/ray.rs:54:23
   |
54 |             transformation_matrix.transform_vector(w);
   |                                                                ^^^^^^^^^^^^^^^^

error: aborting due to previous error

I'm pretty sure this is a non-issue, but I can't seem to figure it out right now :/

David Harvey-Macaulay
@alteous
@brendanzab Are you around?
Brendan Zabarauskas
@brendanzab
Heading to sleep soon
David Harvey-Macaulay
@alteous
Sweet, I have a quick question: I've copied some cgmath code into the gltf crate. I want to make sure all the copyright formalities are in place. Would you mind reviewing this file? https://github.com/gltf-rs/gltf/pull/223/files#diff-b2e459ded86685302d79df1ad4c8671c
Brendan Zabarauskas
@brendanzab
I’ll have a look tomorrow- do you mind pinging me if I don’t?
David Harvey-Macaulay
@alteous
Thanks, and sure. :)
Brendan Zabarauskas
@brendanzab
It should be ok- just be aware that it will be hard to change the license if you do - seeing as you’d need the ok from all the folks who’d contributed on that bit of code
I’m not actively maintaining cgmath anymore - I think most people are moving to nalgebra
David Harvey-Macaulay
@alteous
Understood.
Brendan Zabarauskas
@brendanzab
Ah cool, I see - you are removing it as a dependency - yup that seems fine
David Harvey-Macaulay
@alteous
...by copying and pasting the code. :D
Brendan Zabarauskas
@brendanzab
hehe, np
Dávid Kocsis
@kocsis1david

https://github.com/rustgd/cgmath/blob/master/src/quaternion.rs#L50

Shouldn't the scalar part be after the vector part?
I'm writing a gltf reader and it seems that gltf stores the scalar part of the quaternion in the w component of the vec4. I just transmuted the vec4 into Quaternion because it's marked as repr(C).

boxdot
@boxdot
Hi, all is there any progress on this issue: rustgd/cgmath#384 If not, I would like to work on it.
(The issue is about the support for 3x4 and 4x3 matrices)
runemopar
@runemopar
I am having an unreasonable amount of trouble getting a 4x4 identity matrix