### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Topics - Knuffi

Pages: [1]
1
##### Support / Rotating a cylinder in a direction given by a simple vector
« on: April 16, 2012, 10:40:51 pm »
I don't get it.

I have a cylinder representing a line. And on building it, I want to translate it to a certain point (working) and rotate it, that it looks into the same direction as a given vector. The last thing does not work.
When I give the vector
* (1/0/0), the cylinder's direction is the z-axis (or -z, I could not see),
* (0/1/0) the cylinder's direction is also the z-axis (or -z)
* (0/0/1) the cylinde's direction is the x-axis.

I changed the coordinate system to an "upright" as needed in school.

Code: [Select]
`public static void addGerade(Gerade g){ Object3D gt = Primitives.getCylinder(6, 0.1f, 150);// Changing the ccordinates from the calculated line to the ones needed to draw it double ax = g.getA().getX1(); double ay = -g.getA().getX3(); double az = g.getA().getX2(); double rx = g.getV().getX(); double ry = -g.getV().getZ(); double rz = g.getV().getY(); SimpleVector Aufpunkt = new SimpleVector (ax, ay, az); SimpleVector Richtung = new SimpleVector(rx, ry, rz); Matrix r = Richtung.getRotationMatrix(); gt.setRotationMatrix(r); gt.translate(Aufpunkt); gt.setTexture("linet"); gt.build(); world.addObject(gt); buffer.clear(java.awt.Color.DARK_GRAY); world.renderScene(buffer);// world.drawWireframe(buffer, Color.WHITE); world.draw(buffer); buffer.update(); }`

Almost the same code works fine with points (as already said, translating works) and even planes (translating and rotating so that the normal vector looks into a given direction.

Can anybody help?

2
##### Support / Planes only visible from the upper side?
« on: April 08, 2012, 07:27:00 pm »
Are planes in wireframe view only visible from the upper side? When I move my camera blow a plane, it disappears.

3
##### Support / Rotating the Camera up an down around the Origin
« on: April 08, 2012, 12:42:34 pm »
I have Objects siting at the origin and want to rotate the camera around that point.

Rotating left and right is no problem, as it is always a rotation around the y-axis. But Rotating up and down is quite difficult, as it is no rotation around a fixed axis. I looked into the methods of the camera, the SimpleVector and the Matrixc, but did not really find something to work with.

Can anyone give me a tip?

4
##### Support / Software Renderer in Swing Component and swapping out the jPCT class
« on: April 05, 2012, 03:55:33 pm »
Hello,

I searched this site, but did not find any hint. I read the examples which render the "Hello World" in software, OpenGL and AWTGL, but I don't get the clue.
I have two problems:
1. I want to render a scene in a JPanel. As it is not very GPU demanding, software renderer will be enough - as I read, it is the only one really working with SWING components. Can someone give me an example? I thought, I've seen one somewhere in the wiki, but I can't find it anymore.

2. Is it possible to swap the HelloWorld class out of the "GUI class"?
As the GUI of the programme I want to write is very complex, I use WindowsBuilder in Eclipse, so I want to write a jPCT class and then just call it in the GUI. Is this possible?