class Point3D { public int x, y, z; public Point3D(int X, int Y, int Z) { x = X; y = Y; z = Z; } } class Edge { public int a, b; public Edge(int A, int B) { a = A; b = B; } } public class DrawCube3D extends Applet implements MouseListener, MouseMotionListener { private static final long serialVersionUID = 1L; int width, height; int mx, my; Image imag; Graphics graph; int azimuth = 35, elevation = 30; Point3D[] vertices; Edge[] edges;
public void init() { setSize(640, 480); width = getSize().width; height = getSize().height; vertices = new Point3D[8]; vertices[0] = new Point3D(-1, -1, -1); vertices[1] = new Point3D(-1, -1, 1); vertices[2] = new Point3D(-1, 1, -1); vertices[3] = new Point3D(-1, 1, 1); vertices[4] = new Point3D(1, -1, -1); vertices[5] = new Point3D(1, -1, 1); vertices[6] = new Point3D(1, 1, -1); vertices[7] = new Point3D(1, 1, 1); edges = new Edge[12]; edges[0] = new Edge(0, 1); edges[1] = new Edge(0, 2); edges[2] = new Edge(0, 4); edges[3] = new Edge(1, 3); edges[4] = new Edge(1, 5); edges[5] = new Edge(2, 3); edges[6] = new Edge(2, 6); edges[7] = new Edge(3, 7); edges[8] = new Edge(4, 5); edges[9] = new Edge(4, 6); edges[10] = new Edge(5, 7); edges[11] = new Edge(6, 7); imag = createImage(width, height); graph = imag.getGraphics(); drawWireFrame(graph); addMouseListener(this); addMouseMotionListener(this); } void drawWireFrame(Graphics g) { double theta = Math.PI * azimuth / 180.0; double phi = Math.PI * elevation / 180.0; float cosT = (float) Math.cos(theta), sinT = (float) Math.sin(theta); float cosP = (float) Math.cos(phi), sinP = (float) Math.sin(phi); float cosTcosP = cosT * cosP, cosTsinP = cosT * sinP, sinTcosP = sinT * cosP, sinTsinP = sinT * sinP; Point[] points; points = new Point[vertices.length]; int scaleFactor = width / 4; float near = 3; int i; float nearToObj = 1.5f;
for (i = 0; i < vertices.length; i++) { int x0 = vertices[i].x; int y0 = vertices[i].y; int z0 = vertices[i].z; float x1 = cosT * x0 + sinT * z0; float y1 = -sinTsinP * x0 + cosP * y0 + cosTsinP * z0; float z1 = cosTcosP * z0 - sinTcosP * x0 - sinP * y0; x1 = x1 * near / (z1 + near + nearToObj); y1 = y1 * near / (z1 + near + nearToObj); points[i] = new Point((int) (width / 2 + scaleFactor * x1 + 0.5),(int) (height / 2 - scaleFactor * y1 + 0.5)); } g.setColor(Color.black); g.fillRect(0, 0, width, height); g.setColor(Color.green); for (i = 0; i < edges.length; ++i) { g.drawLine(points[edges[i].a].x, points[edges[i].a].y, points[edges[i].b].x, points[edges[i].b].y); } }
April 1, 2009 at 3:19 PM
cont.... public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { mx = e.getX(); my = e.getY(); e.consume(); } public void mouseReleased(MouseEvent e) { } public void mouseDragged(MouseEvent arg0) { int new_mx = arg0.getX(), new_my = arg0.getY(); azimuth -= new_mx - mx; elevation += new_my - my; drawWireFrame(graph); mx = new_mx; my = new_my; repaint(); arg0.consume(); } public void update(Graphics g) { g.drawImage(imag, 0, 0, this); System.out.println("azimuth: " + azimuth + ", elevation: " + elevation); } public void paint(Graphics g) { update(g); } public void mouseMoved(MouseEvent arg0) { } }
Then call it by using applet tag of html page like this:
java or 3d java or 3d can we use of 3d in core java?
if yes pls tell me a demo example of 3djava.
thanks...
Have a look at the following link:
http://www.roseindia.net/answers/viewqa/Java3D/8406-java.html
3D JButton in java? 3D JButton in java? how we can create 3D button in java.
thanks
java 3d code - Java3D java3d code can u please send source code, how to clear canvas3d in java3d. In my project if i click on clear button in awt frame then canvas must be clear, please send code
Java 3D - Java3D Java3D Hi
can u tell me
how can i write the code to develop the 3Dimension figure in java hi Sivaraman,
Create Java Applet.
import java.applet.*;
import java.awt.*;
import java.awt.event.
3D PASSWORD 3D PASSWORD HI i would like to know abt where the 3d password in india used and also few info about the 3d password pls rply some1 as soon as possible
JavaFX 3D Effect Example
JavaFX 3D Effect Example
Working with java Collections class
In this section... java collections framework is a
set of classes and interfaces that are used
3d pie chart - Java3D 3d pie chart Dear Sir,
i want to create 3d pie chart using jsp, i have some code for 2d pie chart in jsp and 3d pie chart in applet. for 2d pie chart my jsp page is running properly but for 3d i used some code from applet
What is 3D Printing? 3D printing is one of those technologies that made manual job with the objects... and in the meantime we lose the erstwhile sense of solid sensory reality. 3D printing... is manufactured meticulously following the design, look and feel of a digital 3D
3D Pie Chart 3D Pie Chart
In this section we are providing you an example to create a
3D Pie Chart.
Description of Program :
For creating a 3D Pie Chart we use
3D Bar Chart 3D Bar Chart
In this section we are providing you an example to
create a 3D Bar Chart.
Description of Program
For creating a 3D Bar chart we use the object
JavaFX 3D Effect Example
JavaFX 3D Effect Example
We can create an Object in JavaFX and can give him 3D Effect (like Creating Sphere with Circle and 3D text by blurring Text in background
JFree 3D Bar Chart not displaying in JSP - Java3D
JFree 3D Bar Chart not displaying in JSP Hi
I am trying to run JFree 3D bar chart written in your site under link:
http://www.roseindia.net/chartgraphs/3Dbarchart-in-jsppage.shtml
This is not working. PNG file
Open Source Game Engine
and others. JOAL gives Java technology developers access to hardware-accelerated 3D... is a real-time 3D rendering environment for all of your real-time 3D needs... world-class, real-time 3D applications today. If you are new to developing
Stacked 3d Bar Chart Example using JFreeChart
Stacked 3d Bar Chart Example using JFreeChart... a Stacked 3d bar chart using JFreeChart.
Bar chart will represent the score...;
new StackedBarChart3D("Stacked 3D Bar Chart"
Create a 3D bar chart in JSP page using JFreeChart
Create a 3D bar chart in JSP page using JFreeChart
This Example shows you how to create a 3D bar chart in jsp page using JFreeChart. Code given below creates a bar
JavaFX
JavaFX
JavaFX 3D Effect Example
We can create an Object in JavaFX and can give him 3D Effect (like Creating Sphere with Circle and 3D text
JavaFX Scripting Language Java Swing, Java 2D and Java3D for developers and
content authors.
In layman... to create rich media and
interactive content for deployment on Java environments...
large programs using Java technology. It gives Java developers the power
java
the world, Banking Application, view 3D image and Shopping Cart. Java find its...java what is javajava is a programing langauge
Java is an objected oriented programming language. It is designed to work
java graphics - Design concepts & design patterns java graphics i dont wanna use Java3D but put solid 3D objects on screen, use z-buffering, ray-casting etc. to make realistic images...this will help build 3D fractals etc...Where must i begin reading
Ajax3D
Ajax3D
Fostering the development of web-based 3D applications
and online virtual worlds using Ajax and X3D-based open technologies.
Read full Description
Java Runtime Java Runtime
In this section, you will learn about Java Runtime
Environment (JRE), it also known as Java Runtime. This is a part of Java
Development Kit (JDK). It is a set
java - Java Beginners
{
int day=d.get(Calendar.DAY_OF_MONTH);
System.out.printf("%3d
trafic site statistics - Java Server Faces Questions
trafic site statistics Hello,
Does the framework JSF work for creating web pages containing 3D entities (like 3DCharts)and displaying web trafic... correspond the balises d:chartItem to a java class (Bean)?
Thanks for any
Java API
and messaging application.
Java3D A scene graph based 3D API.
Java Open GLA wrapper...Java API
what is Java API?
API stands for Application Programming Interface... of code. Java Application
Programming Interface is a library of classes
about java1
about java1 Sir,
i want to know how we develop 3d button ,lable,textfield etc. in java .
sir plz give one program as well
Thank you
Java Download
around the world
and 3D images. Java makes these types of applications...
Java Download
In this section, you will learn about java download.
Before downloading it you
java - Java3D
java example of 3d Hi Friend,
Try the following code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import.......
To load an applet, create applet.html:
Java Applet Demo
Hope
Chart & Graphs Tutorials in Java
Chart & Graphs Tutorials in Java
 ... in Java. Our Chart and Graphs
tutorials will help learn everything you need to learn about chart and graphs
programming in Java. We have provided many examples
Java API Java API
What is Java API?
Java API is not but a set of classes and interfaces that comes with the JDK. Java API is actually a huge collection of library routines
Formatted Output
("| %3d |", n);
would print
| 2 |
Complete format specification
Read the Java API...
Java NotesFormatted Output
Java 5 implements formatted output with printf..., there was no built-in way to right justify numbers in Java until Java 5.
You had to use
VLOS 1.3 Alpha 4 is released now
VLOS 1.3 Alpha 4 is released now
This alpha4 release of VLOS 1.3 with many new features and enhancements: Anaconda updated to FC5-test3, Xgl with Compiz, 3D... including: Anaconda updated to FC5-test3, Xgl with compiz, 3D support by default
Flex Java Developers
Flex Java Developers
Adobe Flex is a standards-based programming methodology... RIA.
Flex uses Sun's Java Environment for developing Rich Internet... to develop an interactive website on
Java, and Flex uses Java Environment, so
What is the use of java?
the world, Banking Application, view 3D image and Shopping Cart. Java
find its...
What is the use of java?
Introduction.
Java technology is
a high-level programming