• Advertisement
Sign in to follow this  

Converting C# to Java

This topic is 2061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm attempting to convert my C# project that I have been working on to Java.
I'll have more questions as I am converting it, but what is the Java equivalent of a Vector2 in C#? Will it require a framework or API? Edited by Key

Share this post


Link to post
Share on other sites
Advertisement
There is none in either language.

There are many graphics packages (including one by Sun) that define their own numeric vector classes.

That said, if you are using XNA or some other library for your graphics, it almost certainly contains numeric vector classes. The same holds true for Java and 3D packages available in it. Edited by frob
Clarify that these are numeric vectors, not the general container vector.

Share this post


Link to post
Share on other sites
In the vanilla JDK there is no such thing, although it is fairly easy to roll your own.

That said, there are plenty of 3rd party options. LibGDX, JME, et. al. all have their own [internal] math libraries you can use if you'd like. The easiest would probably be to use the Vecmath (javax.vecmath) package, which is a standalone library that was liberated from J3D. There are many ways to obtain it (package managers, Maven, etc.), but it's homepage for the source is here: http://java.net/projects/vecmath. The corresponding class to C#'s Vector2 would be Vector2f.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement