As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In Actionscript and 3D systems, the Y axis increases upwards (bottom is either 0 or -1, and top is usually 1). This convention makes sense relative to the real world. However in languages such as Java, the convention is flipped (bottom is 1, and top is 0 or -1). I've always wondered: Why?
Thanks! :)
In 2D software, the y-direction is typically downwards - top left corner of the screen is the origin. The first screens were text only, and you would number text lines from the top. This numbering system stuck.
In 3D software, many libraries choose to implement Y as up, but only because, as you've mentioned, that "makes more sense".
This is not a feature of the "language". It's a feature of the library.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am trying to add AWGN to my audio file. I convert my wav file to byte array. I am trying to add 10dB AWGN to this array. In matlab there is imnoise which adds AWGN to image. In java is there any library? Thanks in advance.
If you actually need the additive Gaussian white noise output similar to that of Matlab's imnoise function, this is the extent of the code that you need to implement in Java:
B = A+MU+STD*randn(size(A))
where A is your input data, B is your output of the same size, MU is the mean of the noise, and STD is the standard deviation. Independent and identically distributed (IID) Gaussian white noise is added to each component of A. This calculation needs to be done in floating point (as many of Matlab's image processing routines are).
The randn function produces normal random variates. You can use java.util.Random.nextGaussian() to produce these. If you need some extra speed, try a Java implementation of the Mersenne Twister algorithm.
Not sure if i got the question correctly. Ist that the thing your are looking for and then just regulate the db over whatever player you are using?
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm looking for a java 2D graphics library for displaying node link diagrams (i.e. graphs). What I need:
add MouseListener to an element or similar functionality
highlight elements (redundant to 3 or 4)
show/hide elements
alter elements (thickness, color etc.)
automatic repainting
scaling/zooming, panning, rotating
nice to have: simple animation. Think of visualizing a force-based algorithm.
foss
rather simple, not necessarily a game engine
maintained/still developed ("alive")
I would probably use a quad tree, especially for efficient mouse enter/exit events. Anyway, a suitable solution should exist.
Some candidates:
G - last version from 2009
Piccolo2D - last version from 2011
jTem - last version from 2010
processing - (not sure what this actually is)
pulpcore - discontinued
acm.graphics - last version from 2006
Almost all are rather old. I'd prefer G, but the last version is from 2009.
I use the Java Unified Network Graph (JUNG) framework. It definitely meets criteria 1-9 on your list, comes with mouse event handling, but option 10 is a little fuzzy. Version 2 is old (2010) but is stable enough that it's used in a number of corporate apps currently under development at my place of employment.
http://jung.sourceforge.net/
I believe someone is working on JUNG 3.0, but I'm not sure if it ever got off the ground. At any rate, JUNG is definitely worth a look - highly extensible and comes with a lot of visualization and analysis algorithms baked in.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am trying to create an image that contains nodes (represented as rectangles) and a path. Two consecutive nodes in the path should be connected with a directed edge (line and an arrowhead at the end). Each line should start at the center of a rectangle and point towards the center of the next rectangle in the path.
The question is whether there is any easy way to calculate the point where each arrow hits the rectangle. Rectangles are not necessarily aligned horizontally and/or vertically, so this is not trivial.
I have managed to come up with a solution that works quite well, but I had to remember all the geometry I was taught at school. Maybe there is an easier way to do it with rotations, instead of calculating directly the end point?
In this example, the endpoints coincide with the centers of the connected rectangles; this obviates the need to calculate the intersection explicitly.
A similar approach is taken in the example cited here, using symmetric shapes.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
If I have a 2x2 image (with the following pixel colors below), and am rotating the pixels counterclockwise by 90 degrees, what would the new arrangement be?
{Pixel.BLACK, Pixel.BLUE},
{Pixel.RED, Pixel.GREEN}
I know this is a simple question, but my test case keeps on failing and I am guessing that perhaps my logic may be incorrect.
BLUE, GREEN
BLACK, RED
If your coordinates were rows.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to represent quite some data for which a cube grid would just make perfect sense. Does such a thing exist for Swing?
A "cube grid" looks like this (and it's really darn impressive):
http://www.smartclient.com/smartgwtee/showcase/#cube_analytics
You can try JIDE Pivot table. I think it is pretty close to what you need.
More info at http://www.jidesoft.com/products/pivot.htm
Try out the free and simple Java swing component https://github.com/aristsoft/jpivot to visualize the data in multidimentional view.
It designed just to show the data, so it don't doing the data aggregation any kind itself.