Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 10 11 [12] 13
  ignore  |  Print  
  Java OpenGL Math Library (JOML)  (Read 215903 times)
0 Members and 1 Guest are viewing this topic.
Online Spasi
« Reply #330 - Posted 2015-08-25 10:10:40 »

So it would be probably hundreds of small changes which produce identical native code.

That's OK. The useful metric isn't "how many line changes in the PR", but "how easy it is for the project owner to review the PR".
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #331 - Posted 2015-08-25 15:10:37 »

What I had in mind was removing trivially inlinable (aka hotspot doesn't even think about it...just does it) code repeats into methods.
Yes, please do this. BUT keep in mind the reason of refactoring: to make future code changes easy. There is no point in refactoring methods that will never change again in JOML, such as maybe refactoring the copy constructor of Vector4f and its respective set() method into a single common private method. This would be a code change that may reduce three lines of code, but will have no future benefit. Also that kind of refactoring would reduce readability of the code, when one has to follow method invocations to see what the code actually does.
So, please spare yourself the effort of trying to refactor trivial methods. Complex methods however, that are likely to change, because people might find faster ways of achieving what that method does, are good candidates for refactorings.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #332 - Posted 2015-08-26 19:41:00 »

So I started a re-factor but stopped (or paused).  There are too many issues of interest before putting the effort in.  First:  there are tons of redundant functionality for marginal (approaching useless) usage (as I've mentioned before) and conversely large holes in common functionality.

But the other big issues is the lack of contracts.  Users are given too much freedom in value ranges which serves zero purpose and this leads to much more complex code (runtime cost).  Users should be limited to partially sane values and the library could provide conicalization methods for users than want to pass in completely random values.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #333 - Posted 2015-08-26 20:04:46 »

I am a big fan of "improve it in small steps," while those steps should also always add value to a library and allow it to evolve. So, please tell me concretely one or two functions that you want to have added to fill the "large holes in common functionality."
Then we can change things. Smiley

Also, please name one or two concrete functions whose contracts should be altered and their implementations then simplified. I don't like to say that again, but again you are being way too vague to induce any change.
So, make things concrete.
Then, we can change things.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #334 - Posted 2015-08-26 20:56:27 »

The big question is:  Is it more important to allow user to supply random input?  Or place logical restrictions on what's deemed legal and if the user breaks the contract:  garbage-in, garbage-out?  This change everything.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #335 - Posted 2015-08-26 21:08:26 »

The big question is:  Is it more important to allow user to supply random input?  Or place logical restrictions on what's deemed legal and if the user breaks the contract:  garbage-in, garbage-out?  This change everything.
I see your point, but can you please make a concrete example with concrete (sane) value ranges for a concrete method in a concrete class?
You see, proposing to "change everything" is just not in there anymore, as there are some number of people now relying on the existing semantics of JOML's methods, and changing everything will break them.
We have to adhere to the Open/Closed Principle here: Change JOML not by modifying it, but by extending it.
There was such a point earlier, when @theagentd requested there to be a matrix multiplication method which assumes the last row to be (0, 0, 0, 1), as that was a typical use case for him. So, we added a new method mul4x3 to JOML. No big deal: No modification of existing code, but extension by adding new code.
That's how things have to be now.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #336 - Posted 2015-08-27 00:03:45 »

Yet another disclaimer:  This is my kinda thinking and the intention of my comments is improve the library, of which I will never be a user because I never use basic math libraries.

Backward compatibly is:  proxy method and refactor OR these classes aren't final...app extents class with marginal use-cases they desire in place.  Forever-and-ever library backward compatibly is a different design space.  Besides nobody has to change from their current version.

On sane ranges examples.  The axis angle classes and conversion thereof should assume the axis is unit magnitude and that the angle is on [-pi, pi].  Likewise on raw input.

Note that AxisAngle4f is used in about 190 methods.  About 2 of these perform any work.  Direct transform of a vec3 and vec4.  Two forwarding methods to the xform.  The remainder is due to a combinatorial explosion of type conversions.   

This is pretty wide spread and serves little to no purpose.  Some examples:

Mixing and matching singles/doubles: 
public Vector2d add(Vector2f v, Vector2d dest)


oh I think you get my attempted point.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #337 - Posted 2015-08-27 06:09:48 »

This is pretty wide spread and serves little to no purpose.  Some examples:
Mixing and matching singles/doubles: 
public Vector2d add(Vector2f v, Vector2d dest)

It does serve purpose, since it was being requested by a user. What is your definition of "serving a purpose?"
Offline Roquen

JGO Kernel


Medals: 518



« Reply #338 - Posted 2015-08-27 08:35:35 »

What do you think about my main point of sensible input ranges and an aux method to enforce at user's request?

Quote
It does serve purpose, since it was being requested by a user.

You're focusing on one element of a combinatorial set.  I suggested way up near the top to let the compiler (and specifically inlining) do the work for you.  Nobody needs to read/write and maintain.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #339 - Posted 2015-08-27 11:55:42 »

Tossed all my old refactor...starting a new one that's less ambitious.  As a data point for my argument: public AxisAngle4f set(AxisAngle4f a).  Pointless code repetition leads to bugs. QED.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #340 - Posted 2015-08-27 12:01:33 »

public AxisAngle4f set(AxisAngle4f a).  Pointless code repetition leads to bugs. QED.
Thanks for the bug report! Fixed.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #341 - Posted 2015-08-27 12:30:39 »

There are some more.  I'm correcting them as I go.  (Like: public AxisAngle4f set(AxisAngle4f a))
Offline Roquen

JGO Kernel


Medals: 518



« Reply #342 - Posted 2015-08-27 12:46:34 »

So any thoughts on range requirements?  I'm seeing internal inconsistencies.  Some axis-angle routines are assuming unit length and others are not.

Also:  Any reason @Override isn't begin used and @SuppressWarnings("hiding") where field hiding is reasonable?

EDIT: And effectively static methods which aren't static.

EDIT 2: I may not have ever said why [-pi,pi]...only one trig op is needed for sin(a) & cos(a).

EDIT 3: Some routines are converting returned angles to positive variants...see EDIT 2.  Make work that reduces their usefulness.

EDIT 4: Quaternion get(AxisAngleXf dest)...checks for non-unit quaternions...I say user's problem.
Offline theagentd
« Reply #343 - Posted 2015-09-03 21:43:47 »

LibGDX has a really useful function where you can generate a quaternion from the rotation between two vectors. I find my self in need of such a function right now. Might be useful to add?

EDIT: http://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another

Myomyomyo.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #344 - Posted 2015-09-03 23:03:28 »

LibGDX has a really useful function where you can generate a quaternion from the rotation between two vectors. I find my self in need of such a function right now. Might be useful to add?
This is already available. Look at Quaternionf.rotationTo and .rotateTo
Offline theagentd
« Reply #345 - Posted 2015-09-03 23:40:58 »

Ah, my bad. xd

Myomyomyo.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #346 - Posted 2015-09-04 07:03:50 »

I feel like crying.  Given unit vectors a & b and we want quaternion q that rotates a into b then solve the rotation equation:

b = qaq*
q = sqrt(ba*)

now carry through the derivation.  The equation ba* is quaternion speak for compose the magnitudes and find the relative angle and containing plane.  Remember how I said that sqrt of unit quaternions and multiply with one conjugated are basic building blocks?  These composed together result in zero trig and one square root.  Apply the quaternion rotation equation 3 times to (1,0,0), (0,1,0) & (0,0,1) and you have a matrix form that requires zero roots in the unit vector case.

EDIT: Oh and it should be obvious that there are not multiple solutions.  The solution is unique.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #347 - Posted 2016-02-08 17:12:23 »

Just noticed that today is JOML's first birthday! Smiley



Celebrating this anniversary with a new 1.7.0 release and the first steps of expanding JOML into the realms of geometric intersection algorithms, some of which are already being used by @theagentd in WSW.
They can be interesting for people wanting to do their own physics, which does not require a full physics engine like jBullet, or just for checking whether things intersect each other.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #348 - Posted 2016-03-08 17:52:59 »

JOML - Reference Card for Matrix4 (Version 1.7.1)
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #349 - Posted 2016-03-08 22:58:07 »

JOML is a good reference, but I had trouble deciphering the algorithms used in Matrix4f, as it deals mainly dumping matrix data into new matrices when translation or rotation goes on.

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline theagentd
« Reply #350 - Posted 2016-03-08 23:21:55 »

Hmm. I see you've started using the word "affine" for certain functions. Might want to rename the "4x3" ones to something like that too, as they work on affine transforms too.

Myomyomyo.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #351 - Posted 2016-03-09 08:23:49 »

Hmm. I see you've started using the word "affine" for certain functions. Might want to rename the "4x3" ones to something like that too, as they work on affine transforms too.
Great idea, thanks! Will do. That's exactly why I like working with people who really know about and are engaged in the topic.
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #352 - Posted 2016-03-09 08:29:35 »

JOML is a good reference, but I had trouble deciphering the algorithms used in Matrix4f, as it deals mainly dumping matrix data into new matrices when translation or rotation goes on.
If you want to know more about the algorithms/formulas, then Wikipedia is a good resource. Many more complex JOML methods are also annotated in their JavaDocs with references to web pages describing the algorithm/formula.
I was being told that Khan Academy has a good course on linear algebra, too: https://www.khanacademy.org/math/linear-algebra
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #353 - Posted 2016-03-09 22:17:49 »

JOML is a good reference, but I had trouble deciphering the algorithms used in Matrix4f, as it deals mainly dumping matrix data into new matrices when translation or rotation goes on.
If you want to know more about the algorithms/formulas, then Wikipedia is a good resource. Many more complex JOML methods are also annotated in their JavaDocs with references to web pages describing the algorithm/formula.
I was being told that Khan Academy has a good course on linear algebra, too: https://www.khanacademy.org/math/linear-algebra

I've searched and searched but anything on the wikipedia math wise isn't legible to me and everyones complex answers don't revolve around how the matrix exists, but just where it is stored. The translations and rotations algorithms don't explain anything on this subject, and for opengl tutorials its all the fixed function pipeline and hidden method bullcrap that are either outdated or just stupid. > Refers to my post about decent learning material <

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline KaiHH

JGO Kernel


Medals: 794



« Reply #354 - Posted 2016-03-09 22:24:23 »

The topic itself is not easy to actually "explain" and I agree with you that it is hard to learn.
At some point with math we just have to simply accept that it is what it is and that it works out.
With rotation I was about to explain this. It has not yet reached at the actual "matrix", but it will lead to it, until I made the step from ad-hoc/manual formula to linear algebra with matrices.
Maybe you can make something out of this.
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #355 - Posted 2016-03-09 22:32:55 »

The topic itself is not easy to actually "explain" and I agree with you that it is hard to learn....

I opened it to look at it and when it didn't explain to me what the coefficients and subscripts were I kind of just assumed and then got bored within two minutes. "Let R represent the rotation and sub x represent the x axis" would be nice. I also found that in school textbooks, the text right next to the code (which btw is in top to bottom per step, not side by side which could come in handy to represent, but I can see why its left to right) which explains the steps briefly like...

2z + 3z + 2z = 180  Set all outer angles equal to the sum of all exterior angles
7z = 180  Combine like terms
z = 180/7  Solve

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline theagentd
« Reply #356 - Posted 2016-03-10 02:38:29 »

Khan Academy's linear algebra videos got me an A in Linear Algebra at my uni. They're AWESOME at explaining the basics and giving you an intuitive idea of what's going on underneath the surface, which sounds like exactly what you want. I can admit that having the tutorials in a video format is a bit annoying since it takes time to watch them, but they're well worth it.

I can totally agree with you about college textbooks being extremely bad at actually TEACHING you new things. They're almost always just throwing shit out there and expecting you to get it. This is especially true for university/college text books in my experience. My statistics book would throw out a crazy formal expression defining a Poisson distribution, not even bothering to explain what the different variables stood for. Khan Academy would start with a binomial distribution, give an example of an interesting problem and then derived the expression for a Poisson distribution to show the motivation and meaning of all variables in an extremely effective way. Khan Academy has their shit straight.

It's also worth mentioning that most of the higher academic world is really frigging annoying when it comes to actually explaining things, and it's best to get used to it. Learning from formal sources takes a crapload of time. I've learned that the best way for me to understand scientific papers is to just read a few things from it each day and trying to understand it. Example: Weighted Blended Order-Independent Transparency. 20 pages just to describe creating a weighted sum and dividing by the weight at the end, plus calculating the alpha value correctly. The code for this is literally ~20 lines. It took me over a week of skimming through the paper a bit every day understanding nothing until it finally clicked, and the ground trembled from the massive "meh" I let out.

Myomyomyo.
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #357 - Posted 2016-03-10 03:17:03 »

Khan Academy isn't the most reliable source for all of that is there. I don't like Khan Academy to a certain extent condoning only subjects. However, I am using it right now to learn the entire course of trig. I am almost done. Proud of myself. *pats back* Pointing

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline HeroesGraveDev

JGO Kernel


Medals: 383
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #358 - Posted 2016-03-10 03:27:22 »

I opened it to look at it and when it didn't explain to me what the coefficients and subscripts were I kind of just assumed and then got bored within two minutes.

Having this sort of attitude is a sure way of never learning anything. Maybe certain concepts came to you easily in the past, but that's no guarantee that it is always going to be the case.

Math is not easy. Programming is not easy. Learning any field beyond a few basic ideas is not easy. If you don't understand something you have to look for explanations, and explanations for those explanations, etc. until you finally get it.
If you find yourself in way over your head, it's probably because you're trying to learn something without the proper foundations of previous concepts, in which case you need to take a step back and learn all those.

If you want to become good at something, you have to work hard at it, whether it's interesting or not.

Offline ziozio
« Reply #359 - Posted 2016-03-10 05:30:40 »

There are SOOO many resources on the internet to learn things that there is almost something for everyone. My favorite for linear algebra is

http://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/

Note there are many other courses there too.

Expecting everything for free though and complaining when "free" doesn't have exactly what you want is not very good. In those situations either pay some money for better material or ask lots of questions on forums to fill in the gaps.
Pages: 1 ... 10 11 [12] 13
  ignore  |  Print  
 
 

 
Riven (521 views)
2019-09-04 15:33:17

hadezbladez (5476 views)
2018-11-16 13:46:03

hadezbladez (2379 views)
2018-11-16 13:41:33

hadezbladez (5737 views)
2018-11-16 13:35:35

hadezbladez (1215 views)
2018-11-16 13:32:03

EgonOlsen (4657 views)
2018-06-10 19:43:48

EgonOlsen (5665 views)
2018-06-10 19:43:44

EgonOlsen (3192 views)
2018-06-10 19:43:20

DesertCoockie (4091 views)
2018-05-13 18:23:11

nelsongames (5030 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!