Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 12 17:55
    kvark commented #497
  • Nov 27 18:27
    elrnv commented #496
  • Nov 26 20:33
    alexandre-janniaux commented #415
  • Nov 26 06:23
    spearman commented #496
  • Nov 25 16:48
    kvark labeled #498
  • Nov 25 16:48
    kvark commented #498
  • Nov 24 21:10
    kocsis1david opened #498
  • Nov 21 02:00
    kvark commented #496
  • Nov 21 01:37
    elrnv commented #496
  • Nov 20 20:42
    jimy-byerley opened #497
  • Nov 19 20:24
    kvark commented #496
  • Nov 05 22:04
    elrnv commented #496
  • Nov 05 21:51
    elrnv commented #496
  • Nov 05 19:54
    elrnv opened #496
  • Nov 05 17:19

    bors[bot] on master

    Added to the Mat3 the possibili… Code formatted with Merge #495 495: Mat3 construct… (compare)

  • Nov 05 16:09
    bors[bot] closed #495
  • Nov 05 16:09
    bors[bot] commented #495
  • Nov 05 15:47

    bors[bot] on staging

    Added to the Mat3 the possibili… Code formatted with Merge #495 495: Mat3 construct… (compare)

  • Nov 05 15:47

    bors[bot] on staging.tmp

    [ci skip][skip ci][skip netlify] (compare)

  • Nov 05 15:39

    bors[bot] on staging.tmp

    Added to the Mat3 the possibili… Code formatted with [ci skip][skip ci][skip netlify… (compare)

↑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)