Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw line in java3d

Tags:

java

3d

I want draw a line between to specify point in java 3d.

how can i do it?

for example for draw a cube we write colorcube.

please help me.

like image 430
Mahdi_Nine Avatar asked Jun 04 '26 22:06

Mahdi_Nine


2 Answers

Use the LineArray class. Create an object for it with two vertices( wherever you want them to be) and add this to a Shape3D object.i.e. new Shape3D(lineArr). For line array:

LineArray lineArr=new LineArray(2,LineArray.COORDINATES);

then:

lineArr.setCoordinate(0,new Point3f());...

do the same for the other vertex.

Then add the shape3D object to a scene graph or Branchgroup.

That should do the trick.

like image 100
Emma Avatar answered Jun 07 '26 10:06

Emma


This post might help you: How to draw lines with Java3D [java-tips.org]

like image 31
dogbane Avatar answered Jun 07 '26 10:06

dogbane