 |
Interactive shapes using parametric equations in 3D
Source code name: "gem3D_crystal.java"
Programming language: Java
Topic: Graphics/3D
DMelt Version 1.4. Last modified: 09/24/1973. License: Pro
https://datamelt.org/code/cache/gem3D_crystal_975.java
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
import java.awt.Color;
import jhplot.*;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import jplot3dp.*;
public class gem3D_crystal {
public static void main(String[] args) {
FPR f1= new FPR("r=0.7; u=2 Pi u; v=Pi v; x=r cos(u) sin(v); y=r sin(u) sin(v); z=r cos(v)");
f1.setDivisions(5,5);
Color c= new Color(255,0,0,128); // 50% transprant
Color cl= new Color(250,10,10,198); // 50% transprant
f1.setLineColor(c);
f1.setFillColor(c);
f1.setFilled(true);
f1.setLineColor(cl);
FPR f2= new FPR("r=0.4; u=2 Pi u; v=Pi v; x=r cos(u) sin(v); y=r sin(u) sin(v); z=r cos(v)");
f1.setDivisions(5,5);
f2.setFillColor(Color.blue);
f2.setFilled(true);
f2.setLineColor(cl);
JFrame frame = new JFrame("Test");
MainComponent jpp = new MainComponent( frame );
jpp.setFunction(f1);
jpp.setFunction(f2);
jpp.setVisible(true);
jpp.getModel().setShowAxes(false,false,false);
//jpp.getModel().cameraForward(1);
jpp.getModel().setFog(true);
int width = 600; int height = 600;
frame.setSize(width, height);
frame.add(jpp);
frame.setVisible(true);
}
}
You see the box below because you did not login.