Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example? #55

Closed
krooq opened this issue Jun 11, 2020 · 7 comments
Closed

Example? #55

krooq opened this issue Jun 11, 2020 · 7 comments
Labels

Comments

@krooq
Copy link

krooq commented Jun 11, 2020

At risk of sounding like an idiot, how does one actually use mint in their code?

Can someone whip up like a tiny example for me, maybe whack it in the README?

@kvark
Copy link
Owner

kvark commented Jun 11, 2020

#11 lists the libraries we know that have integrated mint support. For example, you can look at the code in three-rs examples three-rs/three#24:

dir_light.transform_mut().look_at([150.0, 350.0, 350.0].into(),
                                      [0.0, 0.0, 0.0].into(),
                                      None);

Does that help?

@kvark kvark added the question label Jun 11, 2020
@krooq
Copy link
Author

krooq commented Jun 12, 2020

I understand the "to mint" direction well.
But how do I go about translating back to do some math?
I feel like it's gonna get real ugly real quick if I'm calling into() every time I want to add 2 vectors together?
Maybe this is only the case for operators? Maybe I'm missing something obvious?

@kvark
Copy link
Owner

kvark commented Jun 12, 2020

Well, the point is that the ugly is an implementation detail. The PR I linked contains both "to mint" and "from mint" parts. For example of the latter, see look_at implementation.

@krooq
Copy link
Author

krooq commented Jun 13, 2020

Yeah ok, doesn't seem too bad really.
I think my initial usage attempt was just bit under engineered. I'm used to things "just working" with Rust but here there is a little bit of extra work to do, which honestly I should have expected. Rust has spoiled me with it's type inference!

Thanks for explaining kvark! I'm thoroughly enjoying your contributions to the Rust ecosystem 😄

@kvark
Copy link
Owner

kvark commented Jun 13, 2020

Alright, do you think there needs to be done about this? I.e. are readme changes needed?

@krooq
Copy link
Author

krooq commented Jun 14, 2020

More examples are always welcoming for newbies :)
But I think those that are intending on integrating mint probably immediately know the implications of mint. The concept is pretty straight forward, I think I'm just fairly new to Rust so these things aren't so obvious to me.

@kvark
Copy link
Owner

kvark commented Jun 14, 2020

Yeah, I believe that's the case.

@kvark kvark closed this as completed Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants