must install java 3d beforerun dxf_3ds_loder.exe

이 프로그램은 자바 프로그램으로 c: 드라이브의 루트에 java 3d jvm 있어야 합니다

c:\j2sdk1.4.1_01

===== see1 move ====== selected

button1 - drag ---> view right left turn , go front or go back

button3 - drag ---> view loctation up or down

mouse wheel ---> view up , down turn

===== see 1 rotate ===== selected

button1 - drag ---> view right left turn , view up down turn

===== object rotate ===== selected

button1 - drag ---> object rotate

button2 - drag ---> object scale

button3 - drag --->object move

button1 and button3 -drag ----> mouse x move = object rotate z , mouse y move = object up or down

mouse wheel ---> scalecontrol

===== 3ds , dxf Load ===== selected

model load of 3ds (max) , dxf (auto cad )

=================================

downlod program file ---- click --> dxf_3ds_loder.exe

1124255615_dxf_3ds_loder.zip

dxf_3ds_loder.zip

downlodmodels ----- 3ds (max) , dxf (auto cad )

1124255615_dxf_3ds_models.zip

dxf_3ds_models.zip

=====================================



----------- program begin -------------------------------

/*
=================================================================
by choi myung hwan blog.paran.com/choi7mh , choi7mh@paran.com

Reference this --------------------------
PlatformTest.java
2001 Daniel Selman
http://manning.com/selman
http://www.fsf.org/copyleft/gpl.html
www.j3d.org web site.
//package org.selman.java3d.book.platformtest;

SpurGearThinBody.java 1.3 98/02/20 14:29:59
1996-1998 Sun Microsystems, Inc. All Rights Reserved.

Gear.java 1.5 98/02/20 14:29:55
1996-1998 Sun Microsystems, Inc. All Rights Reserved.

GeomInfoApp.java 1.1 00/09/22 14:03
1996-2000 Sun Microsystems, Inc. All Rights Reserved.

CheckerFloor.java
Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th

Loader3D.java
Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th


=================================================================
*/


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;

import javax.media.j3d.*;
import javax.vecmath.*;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.behaviors.keyboard.KeyNavigatorBehavior;


import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.behaviors.mouse.MouseZoom;
import com.sun.j3d.utils.behaviors.mouse.MouseTranslate;

import java.text.DecimalFormat;

import ncsa.j3d.loaders.*; // Portfolio loaders
import com.sun.j3d.loaders.Scene;
import java.io.*;


/**
* This example illustrates some of the features of the SimpleUniverse
* class. It creates 3 views into a scengraph and associates a ViewerAvatar
* and PlatformGeometry with each Viewer object.<p>
*/
public class dxf_3ds_loder extends Applet
implements ActionListener, MouseListener, MouseMotionListener, ItemListener
, MouseWheelListener
{//---------------

SimpleUniverse sunvs ;

BranchGroup bg ;//= new BranchGroup( );

// size of each Canvas3D
static final intm_kWidth = 256;
static final intm_kHeight = 256;

BoundingSpherem_Bounds = null;

private Switch shadingSwitch = null;


double rad_a = (3.1415927d/180d) ;

//-------------- c1 data ----- begin --------------------------------

double ms_c1_distant_old = -40d ;
ViewingPlatform vp_c1;
Transform3D t3d_c1_by_ms ; //= new Transform3D( );
double ms_c1_y_rot=0 , ms_c1_y_rot_old=0 ;
double ms_c1_x_rot=0 , ms_c1_x_rot_old=0 ;

//-------------- c1 data ----- end ----------------------------------

//-------------- c2 data ----- begin --------------------------------
ViewingPlatform vp2_c2 ; //= new ViewingPlatform( 1 );
Transform3D t3d_c2_by_ms ; //= new Transform3D( );
double ms_start_x=0 , ms_start_y=0 , ms_delta_x=0 , ms_delta_y =0 ;
double ms_c2_x_delta = 0d ,ms_c2_y_delta = 0d ;
double ms_c2_x_rot_old = 0d ,ms_c2_y_rot_old = 0d ;
double z_move=0 , z_move_delta= 0 ;
double x_move=0 , x_move_delta= 0 ;

//double c2_view_rot_x_old =0d;
double c2_view_rot_y_old =0d;// ms_c2_y_rot_old 의 변수는 여러모드에서 동시에 사용하므로 고유한
// 변수가 필요하다

double z_c2_move_btn_old =0 , x_c2_move_btn_old=0 , y_c2_move_btn_old= 0 ;
//-------------- c2 data ----- end ----------------------------------

double move_scale = 1/15d ;

//-------------- c3 data ----- begin --------------------------------
ViewingPlatform vp3_c3 ; //= new ViewingPlatform( 1 );
Transform3D t3d_c3_by_ms ; //= new Transform3D( );
double ms_c3_x_rot=0 , ms_c3_x_rot_old=0 ;
double ms_c3_y_rot=0 , ms_c3_y_rot_old=0 ;
double ms_c3_z_move=0 , ms_c3_z_move_delta= 0 ;
double ms_c3_x_move=0 , ms_c3_x_move_delta= 0 ;

double z_c3_move_btn_old =0 , x_c3_move_btn_old=0 , y_c3_move_btn_old= 0 ;

//-------------- c3 data ----- end ----------------------------------

double see1_move_range = 120d , see2_move_range = 30d ;

Frame frm3df ;
GraphicsConfiguration config ;// = SimpleUniverse.getPreferredConfiguration( );
Canvas data_cvs ;
DecimalFormat dcfm2 = new DecimalFormat("00.0");
DecimalFormat dcfm3 = new DecimalFormat("000");
int data_cvs_wdth =130,data_cvs_heit =60;
String choice_str2 = "gear" ;

Canvas3D c1 , c2 , c3 ;
MouseEvent mevt ;
String get_now_cvs =" ";

Button view_move_btn , view_rotate_btn , object_rotate_btn , ds3_dxf_btn ;
String view_status ="view_move" ;
boolean object_rotate_tf = false ;

//TransformGroup trs_pyrmd ;
//Transform3D trs3d_pyrmd ;
double pyrmd_ms_x_rot_old , pyrmd_ms_y_rot_old ;

//TransformGroup trs_gear ;
//Transform3D trs3d_gear ;

//------------- object Transform3D ---- var.--- begin --------------
int object_max = 30;
int object_y2_max = 10;
int obj_nu = 0 ; //=object number
int obj_nu_last = 3 ; //=object number

TransformGroup[] trsgp_arr = new TransformGroup[object_max] ;
Transform3D [] trs3d_arr = new Transform3D[object_max] ;
double object_dou_arr[][] = new double [object_max][object_y2_max]; //scale 1,rotate 3,move,3
String object_name_arr[] = new String [object_max];
//-------- 마우스에 의한 Transform3D 에의한 변경된 임시변수
double oatcb_6=0, oatcb_7=0, oatcb_8=0, oatcb_9=0, oatcb_1=0, oatcb_2=0 ,oatcb_3=0 ;

Choice choice ;
//------------- object Transform3D ---- var. -- end ----------------

//-------------- ncsa data ----- 3ds --- var. --- begin ----------
BranchGroup loadedBG = null;
DecimalFormat df = new DecimalFormat("0.###"); // 3 dp
Vector3d scaleVec ;
String str1 =" ", str1_name=" ";

//-------------- ncsa data ----- 3ds --- var. --- end ------------

int mouse_wheel_drection = +1 ;
MouseWheelEvent mwhevt ;

PopupMenu w8_5_myPopupMenu;
Canvas popup_cvs ;

public dxf_3ds_loder( )
{ //----------------------------

object_arr_init() ;//----

m_Bounds = new BoundingSphere( new Point3d( 0, 0, 0 ), 400d );
// get the graphics configuration for the graphics device
config = SimpleUniverse.getPreferredConfiguration( );
setLayout(null);

// create the first canvas, this is the top-down view
c1 = new Canvas3D( config );
c1.setSize( m_kWidth, m_kHeight );
c1.setLocation( 10,5 );
add( c1 );
c1.addMouseListener(this);
c1.addMouseMotionListener(this);
c1.addMouseWheelListener(this);

c2_add_start_set();//---

// create the third canvas, this is used for "see2's" Viewer
config = SimpleUniverse.getPreferredConfiguration( );
c3 = new Canvas3D( config );
c3.setSize( m_kWidth, m_kHeight );
c3.setLocation( m_kWidth +30, 5 );
add( c3 );
c3.addMouseListener(this);
c3.addMouseMotionListener(this);
c3.addMouseWheelListener(this);

// c2_add_start_set();//---

addMouseListener(this);
addMouseMotionListener(this);
addMouseWheelListener(this);

add_button();

// create a SimpleUniverse from the ViewingPlatform and Viewer
//SimpleUniverse sunvs = new SimpleUniverse();
BranchGroup scene = createSceneGraph( );

createViewer_c1() ;//----
//sunvs.getLocale( ).addBranchGraph( vp_c1 );
//sunvs.addBranchGraph( vp_c1 );


// add the geometry to the scenegraph
sunvs.addBranchGraph( scene );
BranchGroup scene2 = car_mk( );
sunvs.addBranchGraph( scene2 );

// createViewer_c1() ;//----
//sunvs.getLocale( ).addBranchGraph( vp_c1 );
//sunvs.addBranchGraph( vp_c1 );

// add two more Viewers to the scenegraph
createViewer_c2( "see1", new Color3f( 0.1f, 1.0f, 1.0f ), -5, 8 ) ;
sunvs.getLocale( ).addBranchGraph( vp2_c2 );

createViewer_c3( "see2", new Color3f( 1.0f, 0.1f, 0.1f ), 2, -8 ) ;
sunvs.getLocale( ).addBranchGraph( vp3_c3 );

frm3df.setVisible(true);
}//--------- end public dxf_3ds_loder( ) ------------------

public void createViewer_c1(){//----

// Create the simple environment
//SimpleUniverse sunvs = new SimpleUniverse( vp_c1, viewer );
Viewer viewer = new Viewer( c1 );


// create the first Viewer, this is a static top-down view
// create a ViewingPlatform with 2 TransformGroups above the ViewPlatform
vp_c1 = new ViewingPlatform( 2 );

// create the Viewer and attach to the first canvas
//Viewer viewer = new Viewer( c1 );

// rotate and position the first Viewer above the environment
t3d_c1_by_ms = new Transform3D( );
//double rad_a = (3.1415927d/180d) ;
//t3d_c1_by_ms.rotX( Math.PI / 2.0 );
t3d_c1_by_ms.rotX( rad_a * 22 );
t3d_c1_by_ms.setTranslation( new Vector3d( 0, 0, -40 ) );
t3d_c1_by_ms.invert( );

MultiTransformGroup mtg = vp_c1.getMultiTransformGroup( );
mtg.getTransformGroup( 0 ).setTransform( t3d_c1_by_ms );

// create a SimpleUniverse from the ViewingPlatform and Viewer
sunvs = new SimpleUniverse( vp_c1, viewer );
//SimpleUniverse sunvs = new SimpleUniverse();

//viewer.setViewingPlatform( vp_c1 );

}//------------ end void createViewer_c1() ----

public void ViewPlatformTransform_c1_by_ms() { //-----

double d_temp5 = rad_a * ( ms_c1_x_rot + ms_c1_x_rot_old) ;
double d_temp6 = rad_a * ( ms_c1_y_rot + ms_c1_y_rot_old) ;
//t3d_c1_by_ms.rotY( d_temp5 );t3d_c1_by_ms.rotX( d_temp6 );
// t3d_c1_by_ms.setTranslation( new Vector3d( 0, 0, ms_c1_distant_old ) );

t3d_c1_by_ms.set( new Vector3d( 0, 0, ms_c1_distant_old ) );

Transform3D temp = new Transform3D();
temp.rotY( d_temp5 ); t3d_c1_by_ms.mul( temp );
temp.rotX( d_temp6 ); t3d_c1_by_ms.mul( temp );


t3d_c1_by_ms.invert( );
// vp_c1.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );

MultiTransformGroup mtg = vp_c1.getMultiTransformGroup( );
mtg.getTransformGroup( 0 ).setTransform( t3d_c1_by_ms );
System.out.println(" d_temp5 , 6 ="+d_temp5 + ","+ d_temp6 );

}//------- end void ViewPlatformTransform_c1_by_ms() { //-----


public void ViewPlatformTransform_c1_by_ms_wheel() { //-----

double d_temp5 = rad_a * ( 0 + ms_c1_x_rot_old) ;
double d_temp6 = rad_a * ( 0 + ms_c1_y_rot_old) ;
//t3d_c1_by_ms.rotY( d_temp5 );t3d_c1_by_ms.rotX( d_temp6 );

double d_temp7 = 1d ;
if ( mouse_wheel_drection == 1 ) { d_temp7 = ms_c1_distant_old/3d ; }
if ( mouse_wheel_drection == -1 ) { d_temp7 = ms_c1_distant_old/-10d ; }

ms_c1_distant_old = ms_c1_distant_old + d_temp7 ;
if ( ms_c1_distant_old > -0.01d ) { ms_c1_distant_old = -0.01d ; }
if ( ms_c1_distant_old < -100d ) { ms_c1_distant_old = -100d ; }


//t3d_c1_by_ms.setTranslation( new Vector3d( 0, 0, ms_c1_distant_old ) );
t3d_c1_by_ms.set( new Vector3d( 0, 0, ms_c1_distant_old ) );
Transform3D temp = new Transform3D();
temp.rotY( d_temp5 ); t3d_c1_by_ms.mul( temp );
temp.rotX( d_temp6 ); t3d_c1_by_ms.mul( temp );


t3d_c1_by_ms.invert( );
// vp_c1.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );

MultiTransformGroup mtg = vp_c1.getMultiTransformGroup( );
mtg.getTransformGroup( 0 ).setTransform( t3d_c1_by_ms );
System.out.println("Hello World! c1 --ms_c1_distant_old="+ms_c1_distant_old);

}//------- end void ViewPlatformTransform_c1_by_s_wheel() { //-----

public void ViewPlatformTransform_c2_move_by_ms() { //-----

//t3d_c2_by_ms.set(new Vector3f(0.0f, 0.0f, 0.0f));
rad_a = (3.1415927d/180d) ;
//temp.rotY( rad_a * ms_c2_x_delta );t3d_c2_by_ms.mul(temp);
//temp.rotY( rad_a * ms_c2_y_delta ); t3d_c2_by_ms.mul(temp);
//t3d_c2_by_ms.setScale(2.0);

double d_temp6 = rad_a * ( ms_c2_x_delta + ms_c2_x_rot_old) ;
double d_temp7 = rad_a * ( c2_view_rot_y_old ) ;
//t3d_c2_by_ms.rotY( d_temp6 );

z_move_delta= Math.cos( d_temp6 ) * ms_c2_y_delta ;
x_move_delta= Math.sin( d_temp6 ) * ms_c2_y_delta ;


double z_move_temp = z_move + z_move_delta + x_c2_move_btn_old ;
double x_move_temp = x_move + x_move_delta + z_c2_move_btn_old ;

if ( x_move_temp < -see1_move_range ) { x_move_temp = -see1_move_range; };
if ( z_move_temp < -see1_move_range ) { z_move_temp = -see1_move_range; };
if ( x_move_temp > see1_move_range ) { x_move_temp = see1_move_range; };
if ( z_move_temp > see1_move_range ) { z_move_temp = see1_move_range; };

t3d_c2_by_ms.set( new Vector3d(
x_move_temp , y_c2_move_btn_old , z_move_temp ) );

Transform3D temp = new Transform3D();
temp.rotY( d_temp6 ); t3d_c2_by_ms.mul(temp);
temp.rotX( d_temp7 ); t3d_c2_by_ms.mul(temp);

System.out.println( "x , z loc = "+ x_move_temp + ","+ z_move_temp );

//trans3.setTransform(t3d_c2_by_ms);
vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );
//vp2_c2.setTransform( t3d_c2_by_ms );
//vp2_c2.setNominalViewingTransform().setTransform( t3d_c2_by_ms );

Graphics gg_cvs = data_cvs.getGraphics(); gg_cvs.setColor(Color.yellow);
gg_cvs.fillRect( 0,0, data_cvs_wdth , data_cvs_heit );
gg_cvs.setColor( Color.black );
gg_cvs.drawString("x,y,z=["
+ dcfm2.format( x_move_temp )+" ,"+ dcfm2.format( y_c2_move_btn_old )+" ,"
+ dcfm2.format( z_move_temp )+"]" , 0,16 );
gg_cvs.drawString("Y rotate =["+ dcfm3.format( ms_c2_x_delta + ms_c2_x_rot_old )+"]" , 0,32 );
gg_cvs.drawString("X rotate =["+ dcfm3.format( c2_view_rot_y_old )+"]" , 0,48 );

}//--------end void void ViewPlatformTransform_c2_move_by_ms() { //-----


public void ViewPlatformTransform_c2_button3_move_by_ms() { //-----

double d_temp6 = rad_a * ( ms_c2_x_rot_old) ; // t3d_c2_by_ms.rotY( d_temp6 );

z_move_delta= Math.cos( d_temp6 ) * ms_c2_x_delta ;
x_move_delta= Math.sin( d_temp6 ) * ms_c2_x_delta ;

double y_c2_move_btn_old_temp = y_c2_move_btn_old + ms_c2_y_delta ;
double z_c2_move_btn_old_temp = z_c2_move_btn_old + z_move_delta + x_move ;
double x_c2_move_btn_old_temp = x_c2_move_btn_old - x_move_delta + z_move ;

if ( x_c2_move_btn_old_temp < -see1_move_range ) { x_c2_move_btn_old_temp = -see1_move_range; };
if ( z_c2_move_btn_old_temp < -see1_move_range ) { z_c2_move_btn_old_temp = -see1_move_range; };
if ( x_c2_move_btn_old_temp > see1_move_range ) { x_c2_move_btn_old_temp = see1_move_range; };
if ( z_c2_move_btn_old_temp > see1_move_range ) { z_c2_move_btn_old_temp = see1_move_range; };

t3d_c2_by_ms.setTranslation( new Vector3d(
z_c2_move_btn_old_temp , y_c2_move_btn_old_temp , x_c2_move_btn_old_temp ) );

//System.out.println( "x , z loc = "+ x_c2_move_btn_old_temp + ","+ z_c2_move_btn_old_temp );
vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );


Graphics gg_cvs = data_cvs.getGraphics(); gg_cvs.setColor(Color.yellow);
gg_cvs.fillRect( 0,0, data_cvs_wdth , data_cvs_heit );
gg_cvs.setColor( Color.black );
gg_cvs.drawString("x,y,z=["
+ dcfm2.format( z_c2_move_btn_old_temp )+" ,"+ dcfm2.format( y_c2_move_btn_old_temp )+" ,"
+ dcfm2.format( x_c2_move_btn_old_temp )+"]" , 0,16 );
gg_cvs.drawString("Y rotate =["+ dcfm3.format( ms_c2_x_rot_old )+"]" , 0,32 );


}//--------end void void ViewPlatformTransform_c2_button3_move_by_ms() { //-----

public void ViewPlatformTransform_c3_move_by_ms() { //-----

double d_temp6 = rad_a * ( ms_c3_x_rot + ms_c3_x_rot_old ) ;
t3d_c3_by_ms.rotY( d_temp6 );

ms_c3_z_move_delta= Math.cos( d_temp6 ) * ms_c3_y_rot ;
ms_c3_x_move_delta= Math.sin( d_temp6 ) * ms_c3_y_rot ;

//----- x_c2_move_btn_old , z_c2_move_btn_old 마우스 무브(c3_move_by_ms) 에 의해 얻은 좌표
double z_move_temp = ms_c3_z_move + ms_c3_z_move_delta + x_c3_move_btn_old ;
double x_move_temp = ms_c3_x_move + ms_c3_x_move_delta + z_c3_move_btn_old ;

if ( x_move_temp < -see2_move_range ) { x_move_temp = -see2_move_range; };
if ( z_move_temp < -see2_move_range ) { z_move_temp = -see2_move_range; };
if ( x_move_temp > see2_move_range ) { x_move_temp = see2_move_range; };
if ( z_move_temp > see2_move_range ) { z_move_temp = see2_move_range; };

t3d_c3_by_ms.setTranslation( new Vector3d(
x_move_temp , y_c3_move_btn_old , z_move_temp ) );
vp3_c3.getViewPlatformTransform( ).setTransform( t3d_c3_by_ms );

}//--------end void void ViewPlatformTransform_c3_move_by_ms() { //-----


public void ViewPlatformTransform_c3_button3_move_by_ms() { //-----

double d_temp6 = rad_a * ( ms_c3_x_rot_old ) ; // t3d_c3_by_ms.rotY( d_temp6 );

ms_c3_z_move_delta = Math.cos( d_temp6 ) * ms_c3_x_rot ;
ms_c3_x_move_delta = Math.sin( d_temp6 ) * ms_c3_x_rot ; //ms_c2_x_delta ;

double y_c3_move_btn_old_temp = y_c3_move_btn_old + ms_c3_y_rot ;
double z_c3_move_btn_old_temp = z_c3_move_btn_old + ms_c3_z_move_delta + ms_c3_x_move ;
double x_c3_move_btn_old_temp = x_c3_move_btn_old - ms_c3_x_move_delta + ms_c3_z_move ;//=z_move ;

if ( x_c3_move_btn_old_temp < -see2_move_range ) { x_c3_move_btn_old_temp = -see2_move_range; };
if ( z_c3_move_btn_old_temp < -see2_move_range ) { z_c3_move_btn_old_temp = -see2_move_range; };
if ( x_c3_move_btn_old_temp > see2_move_range ) { x_c3_move_btn_old_temp = see2_move_range; };
if ( z_c3_move_btn_old_temp > see2_move_range ) { z_c3_move_btn_old_temp = see2_move_range; };

t3d_c3_by_ms.setTranslation( new Vector3d(
z_c3_move_btn_old_temp , y_c3_move_btn_old_temp , x_c3_move_btn_old_temp ) );

//System.out.println( "x , z loc = "+ x_c3_move_btn_old_temp + ","+ z_c3_move_btn_old_temp );
vp3_c3.getViewPlatformTransform( ).setTransform( t3d_c3_by_ms );

}//--------end void void ViewPlatformTransform_c3_button3_move_by_ms() { //-----

public void createViewer_c2( String szName, Color3f objColor, double x, double z )
{//-------------
Viewer viewer2 = new Viewer( c2 );
//ViewingPlatform vp2_c2 = new ViewingPlatform( 1 );
vp2_c2 = new ViewingPlatform( 1 );

vp2_c2.setPlatformGeometry( createPlatformGeometry( szName ) );
viewer2.setAvatar( createViewerAvatar( szName, objColor ) );

t3d_c2_by_ms = new Transform3D( );
//t3d_c2_by_ms.setTranslation( new Vector3d( x, 0, z ) );
t3d_c2_by_ms.setTranslation( new Vector3d( x, 2, z ) );
vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );
vp2_c2.getViewPlatformTransform( ).setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
vp2_c2.getViewPlatformTransform( ).setCapability( TransformGroup.ALLOW_TRANSFORM_READ );
/*

MouseTranslate behavior3 = new MouseTranslate( vp2_c2.getViewPlatformTransform( ) );
behavior3.setSchedulingBounds( m_Bounds );
behavior3.setEnable( true ); vp2_c2.addChild( behavior3);
*/
viewer2.setViewingPlatform( vp2_c2 );


//return vp2_c2;
}//-------------------- end ViewingPlatform createViewer_c2( Canvas3D c, //-------------


public void createViewer_c3( String szName, Color3f objColor, double x, double z )
{
// create a Viewer and attach to its canvas
// a Canvas3D can only be attached to a single Viewer
Viewer viewer2 = new Viewer( c3 );

// create a ViewingPlatform with 1 TransformGroups above the ViewPlatform
vp3_c3 = new ViewingPlatform( 1 );

// create and assign the PlatformGeometry to the Viewer
vp3_c3.setPlatformGeometry( createPlatformGeometry( szName ) );

// create and assign the ViewerAvatar to the Viewer
viewer2.setAvatar( createViewerAvatar( szName, objColor ) );

// set the initial position for the Viewer
t3d_c3_by_ms = new Transform3D( );
//t3d_c3_by_ms.setTranslation( new Vector3d( x, 0, z ) );
t3d_c3_by_ms.setTranslation( new Vector3d( x, 2, z ) );
vp3_c3.getViewPlatformTransform( ).setTransform( t3d_c3_by_ms );

// can modify the Viewer's position
vp3_c3.getViewPlatformTransform( ).setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
vp3_c3.getViewPlatformTransform( ).setCapability( TransformGroup.ALLOW_TRANSFORM_READ );

viewer2.setViewingPlatform( vp3_c3 );

/*
MouseRotate behavior = new MouseRotate( vp3_c3.getViewPlatformTransform( ) );
behavior.setSchedulingBounds( m_Bounds );
behavior.setEnable( true );
vp3_c3.addChild( behavior);
*/
//return vp3_c3;
}//------- end ViewingPlatform createViewer_c3( Canvas3D c, String szName, ----


public void wall_making(){//-----------

final int LAND_WIDTH = 12;
final float LAND_HEIGHT = -1.0f;
final int LAND_LENGTH = 12;
final int nTileSize = 2;


// loop over all the tiles in the environment
for( int x = -LAND_WIDTH; x <= LAND_WIDTH; x+=nTileSize ){//---
for( int z = -LAND_LENGTH; z <= LAND_LENGTH; z+=nTileSize ){//----

// if we are on the border of the environment create a
// TransformGroup to position a ColorCube to create a "wall"
if( x == -LAND_WIDTH || x == LAND_WIDTH || z == -LAND_LENGTH || z == LAND_LENGTH )
{
TransformGroup tg = new TransformGroup( );
Transform3D t3d = new Transform3D( );
t3d.setTranslation( new Vector3d( x, 0, z ) );
tg.setTransform( t3d );
tg.addChild( new ColorCube( nTileSize/6d ) );
//tg.addChild( new ColorCube( nTileSize/2 ) );
bg.addChild( tg );
}//---- end if( x == -LAND_WIDTH || x == LAND_WIDTH || z ------
}//-------end for( int z = -LAND_LENGTH; z <= LAND_LENGTH; z+=nTileSize ) ----
}//------- end for( int x = -LAND_WIDTH; x <= LAND_WIDTH; x+=nTileSize ) ----

}//-------- end void wall_making(){//-----------

public void land_making(){//-----------

final int LAND_WIDTH = 6 ;//12;
final float LAND_HEIGHT = -1.0f;
final int LAND_LENGTH = 12;
final int nTileSize = 2;

// calculate how many vertices we need to store all the "tiles"
// that compose the QuadArray.
final int nNumTiles = ((LAND_LENGTH/nTileSize) * 2 ) * ((LAND_WIDTH/nTileSize) * 2 );
final int nVertexCount = 4 * nNumTiles;

Point3f[] coordArray = new Point3f[nVertexCount];
Point2f[] texCoordArray = new Point2f[nVertexCount];
// create an Appearance and load a texture
Appearance app = new Appearance( );
Texture tex = new TextureLoader( "land.jpg", this ).getTexture( );
app.setTexture( tex );
int nItem = 0;
// loop over all the tiles in the environment
for( int x = -LAND_WIDTH; x <= LAND_WIDTH; x+=nTileSize ){//---
for( int z = -LAND_LENGTH; z <= LAND_LENGTH; z+=nTileSize ){//----

// if we are not on the last row or column create a "tile"
// and add to the QuadArray. Use CCW winding and assign texture
// coordinates.
if( z < LAND_LENGTH && x < LAND_WIDTH )//----- land tile
{
coordArray[nItem] = new Point3f( x, LAND_HEIGHT, z );
texCoordArray[nItem++] = new Point2f( 0, 0 );
coordArray[nItem] = new Point3f( x, LAND_HEIGHT, z + nTileSize );
texCoordArray[nItem++] = new Point2f( 1, 0 );
coordArray[nItem] = new Point3f( x + nTileSize, LAND_HEIGHT, z + nTileSize );
texCoordArray[nItem++] = new Point2f( 1, 1 );
coordArray[nItem] = new Point3f( x + nTileSize, LAND_HEIGHT, z );
texCoordArray[nItem++] = new Point2f( 0, 1 );
}//------- end if( z < LAND_LENGTH && x < LAND_WIDTH ) ----

}//-------end for( int z = -LAND_LENGTH; z <= LAND_LENGTH; z+=nTileSize ) ----
}//------- end for( int x = -LAND_WIDTH; x <= LAND_WIDTH; x+=nTileSize ) ----

// create a GeometryInfo and generate Normal vectors
// for the QuadArray that was populated.
GeometryInfo gi = new GeometryInfo( GeometryInfo.QUAD_ARRAY );

gi.setCoordinates( coordArray );//----- land tile
gi.setTextureCoordinates( texCoordArray );//----- land tile

NormalGenerator normalGenerator = new NormalGenerator( );
normalGenerator.generateNormals( gi );

// wrap the GeometryArray in a Shape3D
Shape3D shape = new Shape3D( gi.getGeometryArray( ), app );

// add the Shape3D to the parent BranchGroup
bg.addChild( shape );

}//-------- end void land_making(){//-----------

public void lights_making(){//-----------

// create some lights for the scene
Color3f lColor1 = new Color3f( 0.7f, 0.7f, 0.7f );
Vector3f lDir1 = new Vector3f( -1.0f, -1.0f, -1.0f );
Color3f alColor = new Color3f( 0.2f, 0.2f, 0.2f );

AmbientLight aLgt = new AmbientLight( alColor );
aLgt.setInfluencingBounds( m_Bounds );
DirectionalLight lgt1 = new DirectionalLight( lColor1, lDir1 );
lgt1.setInfluencingBounds( m_Bounds );

DirectionalLight drlgt2 = new DirectionalLight( lColor1, new Vector3f( +1.0f, +1.0f, +1.0f ) );
drlgt2.setInfluencingBounds( m_Bounds );

DirectionalLight drlgt3 = new DirectionalLight(
new Color3f( 0.7f, 0.0f, 0.0f ), new Vector3f( +0.0f, +1.0f, +0.0f ) );
drlgt3.setInfluencingBounds( m_Bounds );

DirectionalLight drlgt4 = new DirectionalLight(
new Color3f( 0.7f, 0.7f, 0.7f ), new Vector3f( +0.0f, -1.0f, +0.0f ) );
drlgt4.setInfluencingBounds( m_Bounds );


PointLight po_light2 = new PointLight (
new Color3f( 0.0f, 0.1f, 0.7f ),
new Point3f ( 0f, 10f, 0f), // position
new Point3f ( 0f, 0, 0)); // attenuation
po_light2.setEnable( true );
po_light2.setInfluencingBounds( m_Bounds );

// add the lights to the parent BranchGroup
bg.addChild( aLgt );
//----- DirectionalLight 는 세개이상 허용되지 않음----
bg.addChild( lgt1 );
bg.addChild( drlgt2 );
// bg.addChild( drlgt3 );
//bg.addChild( drlgt4 );

bg.addChild( po_light2 );

// create a light gray background
Background back = new Background( new Color3f( 0.9f, 0.9f, 0.9f ) );
back.setApplicationBounds( m_Bounds );
bg.addChild( back );


}//--------- end void lights_making(){//-----------


// create a tiled environment from -12 to +12. The environment
// is created from a QuadArray. The environment is surrounded by a ColorCube
// "wall" that is 2 units high (from Z = -1 to Z = 1).
public BranchGroup createSceneGraph( )
{//-----------

// create the parent BranchGroup
bg = new BranchGroup( );

wall_making() ;//-----------
// land_making() ;//-----------

lights_making() ;//-----------

add_multy_geometric() ;//------------

// compile the whole scene
bg.compile();

return bg;
}//--------------- end public BranchGroup createSceneGraph( ) ---------------------


public Shape3D view_axisXYZ(){//---

Shape3D plane = new Shape3D();
float t1 = 0.1f ;
LineArray axisXYZ=new LineArray( 4,LineArray.COORDINATES|LineArray.COLOR_3 );
axisXYZ.setCoordinate(0,new Point3f( t1* 4f,0f ,t1 ) );//left down
axisXYZ.setCoordinate(1,new Point3f( 0f,+33f,0f ));
axisXYZ.setColor(0,new Color3f(1f,1f,0f)); // y
axisXYZ.setColor(1,new Color3f(1f,1f,0f));
axisXYZ.setCoordinate(2,new Point3f( -t1,0f ,t1) );// right down
axisXYZ.setCoordinate(3,new Point3f( 0f,+33f,0f ));
axisXYZ.setColor(2,new Color3f(1f,1f,0f)); // y
axisXYZ.setColor(3,new Color3f(1f,1f,0f));
/*
axisXYZ.setCoordinate(4,new Point3f( t1,0f ,-t1) );// x axis
axisXYZ.setCoordinate(5,new Point3f( 0f,+33f,0f ));
axisXYZ.setColor(4,new Color3f(1f,1f,0f)); // y
axisXYZ.setColor(5,new Color3f(0f,0f,1f));
axisXYZ.setCoordinate(6,new Point3f( -t1,0f ,-t1) );// x axis
axisXYZ.setCoordinate(7,new Point3f( 0f,+33f,0f ));
axisXYZ.setColor(6,new Color3f(1f,1f,0f)); // y
axisXYZ.setColor(7,new Color3f(0f,0f,1f));
*/
plane.setGeometry( axisXYZ ); return plane;
}//--------- end public Shape3D view_axisXYZ(){ //------

// creates and positions a simple Cone to represent the Viewer.
// The Cone is aligned and scaled such that it is similar to a
// 3D "turtle".... Aaah good old Logo.
ViewerAvatar createViewerAvatar( String szText, Color3f objColor )
{//---------
ViewerAvatar viewerAvatar = new ViewerAvatar( );

// rotate the Cone so that it is lying down and
// points sharp-end towards the Viewer's field of view.
TransformGroup tg = new TransformGroup( );
Transform3D t3d = new Transform3D( );
//t3d.setEuler( new Vector3d( Math.PI / 2.0, Math.PI, 0 ) );
t3d.setEuler( new Vector3d( Math.PI / 2.0, Math.PI , 0 ) );
tg.setTransform( t3d );

// create appearance and material for the Cone
Appearance app = new Appearance( );
Color3f black = new Color3f( 0.4f, 0.2f, 0.1f );
app.setMaterial( new Material( objColor, black, objColor, black, 90.0f ) );

// create the Primitive and add to the parent BranchGroup
tg.addChild( new Cone( 1, 3, Primitive.GENERATE_NORMALS, app ) );
tg.addChild( view_axisXYZ() );
viewerAvatar.addChild( tg );

return viewerAvatar;
}//--------- end ViewerAvatar createViewerAvatar( String szText ----

// create a simple Raster text label used to help
// identify the viewer.
PlatformGeometry createPlatformGeometry( String szText )
{
PlatformGeometry pg = new PlatformGeometry( );
pg.addChild( createLabel( szText, 0f, 2f, 0f ) );

return pg;
}//---------- end PlatformGeometry createPlatformGeometry( String szText ) -----

// creates a simple Raster text label (similar to Text2D)
private Shape3D createLabel( String szText, float x, float y, float z )
{
BufferedImage bufferedImage = new BufferedImage( 30, 14, BufferedImage.TYPE_INT_RGB );
Graphics g = bufferedImage.getGraphics( );
g.setColor( Color.white );
g.drawString( szText, 2, 12 );

ImageComponent2D imageComponent2D = new ImageComponent2D( ImageComponent2D.FORMAT_RGB, bufferedImage );

// create the Raster for the image
javax.media.j3d.Raster renderRaster = new javax.media.j3d.Raster ( new Point3f( x, y, z ),
javax.media.j3d.Raster.RASTER_COLOR,
0, 0,
bufferedImage.getWidth( ),
bufferedImage.getHeight( ),
imageComponent2D,
null );

return new Shape3D( renderRaster );
}//---- end private Shape3D createLabel( String szText, float x, float y, flo ---------------


public void actionPerformed( ActionEvent event )
{

if ( event.getSource() == view_move_btn ){ view_status="view_move" ; object_rotate_tf=false;
view_move_btn.setBackground (Color.red );
view_rotate_btn.setBackground (Color.yellow );
object_rotate_btn.setBackground (Color.yellow );
}//-----------
if ( event.getSource() == view_rotate_btn ){ view_status="view_rotate" ; object_rotate_tf=false;
view_move_btn.setBackground (Color.yellow );
view_rotate_btn.setBackground (Color.red );
object_rotate_btn.setBackground (Color.yellow );
}//--------
if ( event.getSource() == object_rotate_btn ){ view_status="view_rotate" ; object_rotate_tf=true;
view_move_btn.setBackground (Color.yellow );
view_rotate_btn.setBackground (Color.yellow );
object_rotate_btn.setBackground (Color.red );
}//--------
if ( event.getSource() == ds3_dxf_btn ){//---
ds3_dxf_model_load_FileDialog();//-----
}//------- end if ----


}//--------end void actionPerformed( ActionEvent event ) -------------

public void mousePressed(MouseEvent e) //---- main position ----
{//-----------
ms_start_x = e.getX();
ms_start_y = e.getY();

} //----------

public void mouseReleased(MouseEvent e) //---- main position ----
{//mevt=e; }

ViewPlatformTransform_mouseReleased() ;//---

}//------

public void mouseClicked(MouseEvent e){//----
if( ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) && e.getSource()==popup_cvs ){//----
w8_5_myPopupMenu.show( popup_cvs , e.getX(), e.getY()); return; }//---
}//---

public void mouseEntered(MouseEvent e)
{ }

public void mouseExited(MouseEvent e)
{ }


public void mouseMoved(MouseEvent e ) //------- main position ---------------
{//-----
mevt = e ;
get_now_cvs_original() ;
// System.out.println("Hello java 3d moved =" + e );
// System.out.println("Hello java 3d moved =" + e.getSource());
// System.out.println(" e.getX() =" + e.getX() );

// if( mevt.getSource() == dxf_3ds_loder() ) { get_now_cvs = "cvs1" ;}

}//------- end void mouseMoved(MouseEvent ev) //---


public void mouseDragged(MouseEvent e) //---- main position ---------------
{ //------
mevt = e ;
get_now_cvs_original() ;

ViewPlatformTransform_canvas_by_ms() ;


//System.out.println(" ms_delta_x,y = " + ms_delta_x +","+ ms_delta_y );
System.out.println(" ms_delta_x,y = " + ms_c2_x_delta +","+ ms_c2_y_delta );


}//--------- end void mouseDragged(MouseEvent e) //-------My_menu3 dragg -----


public void mouseWheelMoved(MouseWheelEvent e) {//------- main position -------------

mwhevt = e ;
int ms_wheel_r = mwhevt.getWheelRotation() ;
if ( ms_wheel_r < 0 ) { mouse_wheel_drection = -1 ; }
if ( ms_wheel_r > 0 ) { mouse_wheel_drection = +1 ; }

System.out.println(" mouse_wheel_drection ="+ mouse_wheel_drection );

if ( get_now_cvs == "cvs2" && view_status=="view_move" && object_rotate_tf==false ){//---
ViewPlatformTransform_c2_rotate_by_ms_wheel(); //-----
}//---- end if ( get_now_cvs == "cvs2" ---

if ( get_now_cvs == "cvs1" ){ //-------
ViewPlatformTransform_c1_by_ms_wheel() ; //-----
}//----- end if ( get_now_cvs == "cvs1" )------

if ( get_now_cvs == "cvs2" && object_rotate_tf==true ){ //-------
object_arr_Transform_c2_by_ms_wheel_scale_upgrade3() ; //-----
}//------ end if ----


}//------- end void mouseWheelMoved(MouseWheelEvent e) -----

public void itemStateChanged(ItemEvent ei) {//------------------ main position ---------------
choice_str2 = (String) ei.getItem();
if ( choice == ei.getSource() ){ obj_nu = choice.getSelectedIndex();
System.out.println(" obj_nu=" + obj_nu );
}//----
}//----- end void itemStateChanged(ItemEvent ei) { ----


//-==================== 새로운 루틴이 추가되는 지역 ========================================
//-==================== 새로운 루틴이 추가되는 지역 ========================================

//---------------------- w8_5_myPopupMenu --------- begin ----------------
public void w8_5_popup_init() //---
{
w8_5_myPopupMenu= new PopupMenu();

// 메뉴 아이템을 만들어 메뉴에 추가
MenuItem w8_5_myMenuItem1= new MenuItem("no exp ---");
w8_5_myMenuItem1.addActionListener(new My_popup_Handler());
w8_5_myPopupMenu.add(w8_5_myMenuItem1);
//-------------- file begin ----------------------------
Menu w8_5_60_subMenu= new Menu("file");
MenuItem w8_5_61_subMenuItem1= new MenuItem("no exp");
w8_5_61_subMenuItem1.addActionListener(new My_popup_Handler());
w8_5_60_subMenu.add(w8_5_61_subMenuItem1);
MenuItem w8_5_62_subMenuItem2= new MenuItem("not define");
w8_5_62_subMenuItem2.addActionListener(new My_popup_Handler());
w8_5_60_subMenu.add(w8_5_62_subMenuItem2);

w8_5_myPopupMenu.add(w8_5_60_subMenu);
//-------------- file end ----------------------------
//-------------- edit begin ----------------------------
Menu w8_5_70_subMenu= new Menu("edit");
MenuItem w8_5_71_subMenuItem1= new MenuItem("copy");
w8_5_71_subMenuItem1.addActionListener(new My_popup_Handler());
w8_5_70_subMenu.add(w8_5_71_subMenuItem1);
w8_5_71_subMenuItem1.disable();
MenuItem w8_5_72_subMenuItem2= new MenuItem("paste");
w8_5_72_subMenuItem2.addActionListener(new My_popup_Handler());
w8_5_70_subMenu.add(w8_5_72_subMenuItem2);
w8_5_72_subMenuItem2.disable();

w8_5_myPopupMenu.add(w8_5_70_subMenu);
//-------------- edit end ----------------------------

popup_cvs.add(w8_5_myPopupMenu);

}//------ end void w8_5_popup_init() //----------


class My_popup_Handler implements ActionListener , ItemListener
{ //-----begin class My_popup_Handler impleme

public void actionPerformed(ActionEvent e)
{ //--- begin void actionPerformed(ActionEvent e) --


//if( (e.getActionCommand()=="image load")) {w8_image_file_load ();}

}//------ end void actionPerformed(ActionEvent e) -----


public void itemStateChanged(ItemEvent e){

System.out.println("itemStateChanged = " +
e.getItem() +" 를 선택하여 ["+ ((CheckboxMenuItem)e.getSource()).getState() +"]가 되었습니다." );

}//---- end void itemStateChanged(ItemEvent e){

}//----------- end class My_popup_Handler implements ActionListener , ItemListener -----

//---------------------- w8_5_myPopupMenu --------- end ------------------


// --------------- model loading ------------- begin ----------------------------------

public void ds3_dxf_model_load_FileDialog(){

str1 = null;

//FileDialog dlg = new FileDialog(this,"파일 다이알로그",FileDialog.LOAD);
FileDialog dlg = new FileDialog( frm3df ," 3ds , (auto cad) dxf file load ",FileDialog.LOAD);
//dlg.show();
dlg.setVisible(true);

str1=dlg.getDirectory()+dlg.getFile();
String str1_this=dlg.getFile();
if ( str1 ==null || str1_this ==null ) { return; }

str1_name=dlg.getFile();

loadModel( str1 );
//BranchGroup scene2 = loadModel( str1 );
//sunvs.addBranchGraph( scene2 );

}//---- end ds3_dxf_model_load (){ -----------------


public void loadModel(String fn){//----
// public BranchGroup loadModel(String fn){ //-------------
/* Load the model from fn into the scene graph using a NCSA
Portfolio loader. Rotate and scale it to make it easier to see.
Store the loaded model's scene in the global loadedScene,
and its branch group in loadedBG.
*/
// FileWriter ofw = null;
System.out.println( "Loading: " + fn );

Scene loadedScene = null;
// BranchGroup loadedBG = null;


/*
try {
ModelLoader loader = new ModelLoader(); // the NCSA portfolio loader
// System.out.println("Loader flags: " + loader.getFlags());
loadedScene = loader.load(fn); // the loaded scene

// Rotate and scale the model
if(loadedScene != null ) {
loadedBG = loadedScene.getSceneGroup(); // the model's BG

Transform3D t3d = new Transform3D();
t3d.rotX( -Math.PI/2.0 ); // models are often on their face; fix that
Vector3d scaleVec = calcScaleFactor(loadedBG, fn); // scale the model
//calcScaleFactor(fn); // scale the model
t3d.setScale( scaleVec );
//t3d.setScale( 0.01 );

TransformGroup tg = new TransformGroup(t3d);
tg.addChild(loadedBG);

bg.addChild(tg); // add (tg->loadedBG) to scene
}
else
System.out.println("Load error with: " + fn);
}
catch( IOException ioe )
{ System.err.println("Could not find object file: " + fn); }
*/


//--------------------- object add to arr. --------- begin --------------------------------------------
//BranchGroup contentRoot = new BranchGroup();


try {
ModelLoader loader = new ModelLoader(); loadedScene = loader.load(fn);

// Rotate and scale the model
if(loadedScene != null ) { loadedBG = loadedScene.getSceneGroup(); // the model's BG
//------------ object 3 -- Transform first set ----------- begin ------------------

Vector3d scaleVec = calcScaleFactor(loadedBG, fn); // scale the model

trs3d_arr[obj_nu_last] = new Transform3D( );
trs3d_arr[obj_nu_last].set( new Vector3f( 0.0f, 0.0f, 0.0f ) );
trs3d_arr[obj_nu_last].setScale( scaleVec );
// trs3d_arr[obj_nu_last].rotX( rad_a * -90d ) ;
Transform3D temp = new Transform3D();
temp.rotX( rad_a * -90d ); trs3d_arr[obj_nu_last].mul(temp);

trsgp_arr[obj_nu_last] = new TransformGroup( trs3d_arr[obj_nu_last] );
trsgp_arr[obj_nu_last].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
trsgp_arr[obj_nu_last].setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

//BranchGroup contentRoot = new BranchGroup(); contentRoot.addChild(trsgp_arr[obj_nu_last]);
trsgp_arr[obj_nu_last].addChild( loadedBG );

object_dou_arr[obj_nu_last][0]= scaleVec.x ;//1d; //scale
object_dou_arr[obj_nu_last][1]= 0d; //rotate y
object_dou_arr[obj_nu_last][2]= -90d; //rotate x
object_dou_arr[obj_nu_last][3]= 0d; //rotate z
object_dou_arr[obj_nu_last][4]= 0.0d; //locate
object_dou_arr[obj_nu_last][5]= 0.0d; //locate
object_dou_arr[obj_nu_last][6]= 0.0d; //locate


//------------ object 3 -- Transform first set ----------- end --------------------
// contentRoot.addChild(trsgp_arr[obj_nu_last]); trsgp_arr[obj_nu_last].addChild( loadedBG );

BranchGroup scene2 = new BranchGroup();
scene2.addChild( trsgp_arr[obj_nu_last] );
sunvs.addBranchGraph( scene2 );


object_name_arr[obj_nu_last]= str1_name ; choice.add( object_name_arr[obj_nu_last] );
obj_nu_last = obj_nu_last + 1 ;// = 3 ; //=object number

}//------- end if(loadedScene != null ) { loadedBG = loa
else { System.out.println("Load error with: " + fn); }

} catch( IOException ioe ){ System.err.println("Could not find object file: " + fn); }

// return contentRoot;

//--------------------- object add to arr. --------- end ----------------------------------------------




} // end of loadModel()


private Vector3d calcScaleFactor(BranchGroup loadedBG, String fn)
//public void calcScaleFactor(String fn)
// Scale the model based on its original bounding box size
{
BoundingBox boundbox = new BoundingBox( loadedBG.getBounds() );
// System.out.println(boundbox);
// obtain the upper and lower coordinates of the box
Point3d lower = new Point3d();
boundbox.getLower( lower );
Point3d upper = new Point3d();
boundbox.getUpper( upper );

// store the largest X, Y, or Z dimension and calculate a scale factor
double max = 0.0;
if( (upper.x - lower.x ) > max ) { max = (upper.x - lower.x ); }
if( (upper.y - lower.y ) > max ) { max = (upper.y - lower.y ); }
if( (upper.z - lower.z ) > max ) { max = (upper.z - lower.z ); }


double scaleFactor = 10.0/max; // 10 is half the width of the floor
System.out.println("max dimension: " + df.format(max) +
"; scaleFactor: " + df.format(scaleFactor) );

// limit the scaling so that a big model isn't scaled too much
if( scaleFactor < 0.0005 ){ scaleFactor = 0.0005; }

//scaleVec = new Vector3d(scaleFactor, scaleFactor, scaleFactor);
return new Vector3d(scaleFactor, scaleFactor, scaleFactor);

} // end of calcScaleFactor()


// --------------- model loading ------------- end ---- --------------------------------

//---------------- class ColouredTiles ----------------------- begin ----------------------------

public class ColouredTiles extends Shape3D
{
private QuadArray plane;


public ColouredTiles(ArrayList coords, Color3f col)
{
plane = new QuadArray(coords.size(),
GeometryArray.COORDINATES | GeometryArray.COLOR_3 );
createGeometry(coords, col);
createAppearance();
}


private void createGeometry(ArrayList coords, Color3f col)
{
int numPoints = coords.size();

Point3f[] points = new Point3f[numPoints];
coords.toArray( points );
plane.setCoordinates(0, points);

Color3f cols[] = new Color3f[numPoints];
for(int i=0; i < numPoints; i++)
cols[i] = col;
plane.setColors(0, cols);

setGeometry(plane);
} // end of createGeometry()


private void createAppearance()
{
Appearance app = new Appearance();

PolygonAttributes pa = new PolygonAttributes();
pa.setCullFace(PolygonAttributes.CULL_NONE);
// so can see the ColouredTiles from both sides
app.setPolygonAttributes(pa);

setAppearance(app);
} // end of createAppearance()


} // end of ColouredTiles class

//---------------- class ColouredTiles ----------------------- end ------------------------------


public class CheckerFloor
{

//-------------- CheckerFloor -------- var. ------------- begin --------------------------

private final static int FLOOR_LEN = 20; // should be even

// colours for floor, etc
private final Color3f blue = new Color3f(0.0f, 0.1f, 0.4f);
private final Color3f green = new Color3f(0.0f, 0.5f, 0.1f);
private final Color3f medRed = new Color3f(0.8f, 0.4f, 0.3f);
private final Color3f white = new Color3f(1.0f, 1.0f, 1.0f);

private BranchGroup floorBG;

float CheckerFloor_y_loc = -1.0f;

//-------------- CheckerFloor -------- var. ------------- end ----------------------------


//-------------- CheckerFloor ------------------------- begin -------------------------------------------

public CheckerFloor()
// create tiles, add origin marker, then the axes labels
{
ArrayList blueCoords = new ArrayList();
ArrayList greenCoords = new ArrayList();
floorBG = new BranchGroup();

boolean isBlue;
for(int z=-FLOOR_LEN/2; z <= (FLOOR_LEN/2)-1; z++) {
isBlue = (z%2 == 0)? true : false; // set colour for new row
for(int x=-FLOOR_LEN/2; x <= (FLOOR_LEN/2)-1; x++) {
if (isBlue)
createCoords(x, z, blueCoords);
else
createCoords(x, z, greenCoords);
isBlue = !isBlue;
}
}
floorBG.addChild( new ColouredTiles(blueCoords, blue) );
floorBG.addChild( new ColouredTiles(greenCoords, green) );

addOriginMarker();
labelAxes();
} // end of CheckerFloor()


private void createCoords(int x, int z, ArrayList coords)
// Coords for a single blue or green square,
// its left hand corner at (x,0,z)
{
// points created in counter-clockwise order
Point3f p1 = new Point3f(x, CheckerFloor_y_loc, z+1.0f);
Point3f p2 = new Point3f(x+1.0f, CheckerFloor_y_loc, z+1.0f);
Point3f p3 = new Point3f(x+1.0f, CheckerFloor_y_loc, z);
Point3f p4 = new Point3f(x, CheckerFloor_y_loc, z);
coords.add(p1); coords.add(p2);
coords.add(p3); coords.add(p4);
} // end of createCoords()


private void addOriginMarker()
// A red square centered at (0,0,0), of length 0.5
{ // points created counter-clockwise, a bit above the floor
Point3f p1 = new Point3f(-0.25f, CheckerFloor_y_loc+0.01f, 0.25f);
Point3f p2 = new Point3f(0.25f, CheckerFloor_y_loc+0.01f, 0.25f);
Point3f p3 = new Point3f(0.25f, CheckerFloor_y_loc+0.01f, -0.25f);
Point3f p4 = new Point3f(-0.25f, CheckerFloor_y_loc+0.01f, -0.25f);

ArrayList oCoords = new ArrayList();
oCoords.add(p1); oCoords.add(p2);
oCoords.add(p3); oCoords.add(p4);

floorBG.addChild( new ColouredTiles(oCoords, medRed) );
} // end of addOriginMarker();


private void labelAxes()
// Place numbers along the X- and Z-axes at the integer positions
{
Vector3d pt = new Vector3d();
pt.y = CheckerFloor_y_loc;
for (int i=-FLOOR_LEN/2; i <= FLOOR_LEN/2; i++) {
pt.x = i;
floorBG.addChild( makeText (pt,""+i) ); // along x-axis
// floorBG.addChild( makeText2(pt,""+i) ); // along x-axis
}

pt.x = 0;pt.y = CheckerFloor_y_loc;int it_7 = 0;
for (int i=-FLOOR_LEN/2; i <= FLOOR_LEN/2; i++) {
pt.z = i;pt.y = CheckerFloor_y_loc;pt.x = 0;
floorBG.addChild( makeText (pt,""+i) ); // along z-axis
pt.z = i+0.5 ; pt.y = CheckerFloor_y_loc;pt.x = 0;it_7=i;
floorBG.addChild( makeText2(pt,""+it_7 ) ); // along z-axis
}
} // end of labelAxes()


private TransformGroup makeText(Vector3d vertex, String text)
// Create a Text2D object at the specified vertex
{
Text2D message = new Text2D(text, white, "SansSerif", 36, Font.BOLD );
// 36 point bold Sans Serif

Appearance app = message.getAppearance();
PolygonAttributes pa = app.getPolygonAttributes();
if (pa == null){ pa = new PolygonAttributes(); };pa.setCullFace(PolygonAttributes.CULL_NONE);
if (app.getPolygonAttributes() == null){ app.setPolygonAttributes(pa);}


TransformGroup tg = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.setTranslation(vertex);
tg.setTransform(t3d);
tg.addChild(message);

return tg;
} // end of getTG()

private TransformGroup makeText2(Vector3d vertex, String text)
// Create a Text2D object at the specified vertex
{
Color3f yellow_3f = new Color3f( Color.yellow );
// "½"
Text2D message2 = new Text2D(text, yellow_3f , "SansSerif", 36, Font.BOLD );
// 36 point bold Sans Serif

Appearance app2 = message2.getAppearance();
PolygonAttributes pa2 = app2.getPolygonAttributes();
if (pa2 == null){ pa2 = new PolygonAttributes(); };pa2.setCullFace(PolygonAttributes.CULL_NONE);
if (app2.getPolygonAttributes() == null){ app2.setPolygonAttributes(pa2);}


TransformGroup tg2 = new TransformGroup();
Transform3D t3d2 = new Transform3D();

//Vector3d vt_7 = new Vector3d();
vertex.y = vertex.y + 0.01;
// t3d.setTranslation( vt_7 );
t3d2.set( vertex );
t3d2.setScale( 1 );
// rad_a = (3.1415927d/180d) ;
//t3d2.rotY( rad_a * 90 );
Transform3D temp = new Transform3D();
temp.rotY( rad_a * 90 ); t3d2.mul(temp);

tg2.setTransform(t3d2);
tg2.addChild(message2);

return tg2;
} // end of getTG()


public BranchGroup getBG()
{ return floorBG; }

//-------------- CheckerFloor ------------------------- end ---------------------------------------------

} // end of CheckerFloor class

//------------- GeomInfoApp -------------- begin ----------------------------

float[] createCoordinateData() {
float[] data = new float[69*3]; // ******
int i = 0;

data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //0
data[i++]= -0.9f; data[i++]= -0.3f; data[i++]= 0.3f; //1
data[i++]= -0.8f; data[i++]= -0.1f; data[i++]= 0.3f; //2
data[i++]= -0.6f; data[i++]= -0.1f; data[i++]= 0.3f; //3
data[i++]= -0.5f; data[i++]= -0.3f; data[i++]= 0.3f; //4
data[i++]= 0.2f; data[i++]= -0.3f; data[i++]= 0.3f; //5
data[i++]= 0.3f; data[i++]= -0.1f; data[i++]= 0.3f; //6
data[i++]= 0.5f; data[i++]= -0.1f; data[i++]= 0.3f; //7
data[i++]= 0.6f; data[i++]= -0.3f; data[i++]= 0.3f; //8
data[i++]= 1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //9
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]= 0.3f; //10
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]= 0.3f; //11
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]= 0.3f; //12
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]= 0.3f; //13
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]= 0.3f; //14
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]= 0.3f; //15
data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //16
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 0 17
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]=-0.3f; // 1 18
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]=-0.3f; // 2 19
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]=-0.3f; // 3 20
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]=-0.3f; // 4 21
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]=-0.3f; // 5 22
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 6 23
data[i++]= 1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 7 24
data[i++]= 0.6f; data[i++]= -0.3f; data[i++]=-0.3f; // 8 25
data[i++]= 0.5f; data[i++]= -0.1f; data[i++]=-0.3f; // 9 26
data[i++]= 0.3f; data[i++]= -0.1f; data[i++]=-0.3f; //10 27
data[i++]= 0.2f; data[i++]= -0.3f; data[i++]=-0.3f; //11 28
data[i++]= -0.5f; data[i++]= -0.3f; data[i++]=-0.3f; //12 29
data[i++]= -0.6f; data[i++]= -0.1f; data[i++]=-0.3f; //13 30
data[i++]= -0.8f; data[i++]= -0.1f; data[i++]=-0.3f; //14 31
data[i++]= -0.9f; data[i++]= -0.3f; data[i++]=-0.3f; //15 32
data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; //16 33
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= 1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 0 34
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 1 35
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]= 0.3f; // 2 36
data[i++]= 1.3f; data[i++]= -0.3f; data[i++]= 0.3f; // 3 37
data[i++]= 1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 4 38
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= 1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 0 39
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]=-0.3f; // 1 40
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]= 0.3f; // 2 41
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]= 0.3f; // 3 42
data[i++]= 1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 4 43
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= 0.5f; data[i++]= 0.0f; data[i++]=-0.3f; // 0 44
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]=-0.3f; // 1 45
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]= 0.3f; // 2 46
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]= 0.3f; // 3 47
data[i++]= 0.5f; data[i++]= 0.0f; data[i++]=-0.3f; // 4 48
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= 0.1f; data[i++]= 0.3f; data[i++]=-0.3f; // 0 49
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]=-0.3f; // 1 50
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]= 0.3f; // 2 51
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]= 0.3f; // 3 52
data[i++]= 0.1f; data[i++]= 0.3f; data[i++]=-0.3f; // 4 53
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= -0.5f; data[i++]= 0.3f; data[i++]=-0.3f; // 0 54
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]=-0.3f; // 1 55
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]= 0.3f; // 2 56
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]= 0.3f; // 3 57
data[i++]= -0.5f; data[i++]= 0.3f; data[i++]=-0.3f; // 4 58
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= -1.1f; data[i++]= 0.0f; data[i++]=-0.3f; // 0 59
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]=-0.3f; // 1 60
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]= 0.3f; // 2 61
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]= 0.3f; // 3 62
data[i++]= -1.1f; data[i++]= 0.0f; data[i++]=-0.3f; // 4 63
System.out.println("end polygon; total vertex count: "+i/3);

data[i++]= -1.3f; data[i++]= 0.0f; data[i++]=-0.3f; // 0 64
data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 1 65
data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; // 2 66
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]= 0.3f; // 3 67
data[i++]= -1.3f; data[i++]= 0.0f; data[i++]=-0.3f; // 4 68
System.out.println("end polygon; total vertex count: "+i/3);

return data;
}//--------------------- end float[] createCoordinateData() { ----------

Appearance createMaterialAppearance(){

Appearance materialAppear = new Appearance();
PolygonAttributes polyAttrib = new PolygonAttributes();
polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
materialAppear.setPolygonAttributes(polyAttrib);

Material material = new Material();
// material.setDiffuseColor(new Color3f(1.0f, 0.0f, 0.0f));
//materialAppear.setMaterial(material);

Color3f yellow_3f = new Color3f( Color.yellow );
Color3f cyan_3f = new Color3f( Color.cyan );
Color3f green_3f = new Color3f( Color.green );
Color3f orange_3f = new Color3f( Color.orange );

material.setAmbientColor( yellow_3f );
material.setDiffuseColor( green_3f );
material.setSpecularColor( cyan_3f );
material.setShininess( 100.10f );


TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(ta.BLENDED);
ta.setTransparency(0.3f);
materialAppear.setTransparencyAttributes(ta);


materialAppear.setMaterial( material );


return materialAppear;
}

Appearance createWireFrameAppearance(){

Appearance materialAppear = new Appearance();
PolygonAttributes polyAttrib = new PolygonAttributes();

polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE);
//polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL );
//polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_POINT );

materialAppear.setPolygonAttributes(polyAttrib);
ColoringAttributes redColoring = new ColoringAttributes();
redColoring.setColor(1.0f, 0.0f, 0.0f);
materialAppear.setColoringAttributes(redColoring);

return materialAppear;
}


//------------------- createPointFrameAppearance() ------- begin -----------------------
Appearance createPointFrameAppearance(){

Appearance materialAppear = new Appearance();
PointAttributes polyAttrib = new PointAttributes();
//polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_POINT );
polyAttrib.setPointSize( 5.0f );

materialAppear.setPointAttributes(polyAttrib);
// ColoringAttributes redColoring = new ColoringAttributes();
// redColoring.setColor( new Color4f(1.0f, 0.0f, 0.0f,0.5f) );
// materialAppear.setColoringAttributes(redColoring);

return materialAppear;
}
//-------------------- createPointFrameAppearance() -------- end -----------------------

public BranchGroup car_mk(){ //------------- 자동차 만들기 --------------------
// public void car_mk(){//----
int total = 0;

System.out.println("\n --- geometry debug information --- \n");

float[] coordinateData = null;
coordinateData = createCoordinateData();
int[] stripCount = {17,17,5,5,5,5,5,5,5}; // ******
// int[] stripCount = {17,17,17}; // ******

for(int i=0; i<stripCount.length; i++){
System.out.println("stripCount["+i+"] = "+stripCount[i]);
total +=stripCount[i];
}

if (total != coordinateData.length/3){
System.out.println(" coordinateData vertex count: "+coordinateData.length/3);
System.out.println("stripCount total vertex count: "+total);
}

GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
gi.setCoordinates(coordinateData);
gi.setStripCounts(stripCount);

Triangulator tr = new Triangulator();
// Triangulator tr = new Triangulator(1);
System.out.println("begin triangulation");
tr.triangulate(gi);
System.out.println(" END triangulation");
gi.recomputeIndices();

NormalGenerator ng = new NormalGenerator();
ng.generateNormals(gi);
gi.recomputeIndices();

// Stripifier st = new Stripifier();
// st.stripify(gi);
// gi.recomputeIndices();

Shape3D part = new Shape3D();
/*
// if(wireFrame==true)
// if(wireFrame==false)
part.setAppearance(createWireFrameAppearance());
else
part.setAppearance(createMaterialAppearance());
*/

// part.setAppearance(createWireFrameAppearance());
part.setAppearance(createMaterialAppearance());
// part.setAppearance(createPointFrameAppearance());



part.setGeometry(gi.getGeometryArray());

/////////////////////////////

BranchGroup contentRoot = new BranchGroup();


//------------ object 2 -- Transform first set ----------- begin ------------------
// Create the transform group node and initialize it to the
// identity. Add it to the root of the subgraph.
// TransformGroup objSpin = new TransformGroup();
// objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// contentRoot.addChild(objSpin);

trs3d_arr[2] = new Transform3D( );
trs3d_arr[2].set( new Vector3f( 5.0f, 4.2f, 0.0f ) );
trsgp_arr[2] = new TransformGroup( trs3d_arr[2] );
trsgp_arr[2].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
trsgp_arr[2].setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
contentRoot.addChild(trsgp_arr[2]);

object_dou_arr[2][0]= 1d; //scale
object_dou_arr[2][1]= 0d; //rotate
object_dou_arr[2][4]= 5.0d; //locate
object_dou_arr[2][5]= 4.2d; //locate
object_dou_arr[2][6]= 0.0d; //locate

//------------ object 2 -- Transform first set ----------- end --------------------


trsgp_arr[2].addChild(part);

////////////////////////
LineStripArray lineArray = new LineStripArray(69, LineArray.COORDINATES, stripCount); //*****
// LineStripArray lineArray = new LineStripArray(51, LineArray.COORDINATES, stripCount); //*****
lineArray.setCoordinates(0, coordinateData);


// PointArray lineArray = new PointArray(69, PointArray.COORDINATES, stripCount); //*****
// PointArray lineArray = new PointArray ( 69, PointArray.COORDINATES | PointArray.COLOR_3 );
// lineArray.setPointSize( 3.3f );
lineArray.setCoordinates(0, coordinateData);


Appearance blueColorAppearance = new Appearance();
ColoringAttributes blueColoring = new ColoringAttributes();
blueColoring.setColor(0.0f, 0.0f, 1.0f);
blueColorAppearance.setColoringAttributes(blueColoring);
LineAttributes lineAttrib = new LineAttributes();
// lineAttrib.setLineWidth(2.0f);
lineAttrib.setLineWidth(2.0f);
blueColorAppearance.setLineAttributes(lineAttrib);
trsgp_arr[2].addChild(new Shape3D(lineArray, blueColorAppearance));

BoundingSphere bounds = new BoundingSphere();

//------------- 자동회전 -------------------------------------
// Alpha rotationAlpha = new Alpha(-1, 16000);
// RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, trsgp_arr[2]);

// a bounding sphere specifies a region a behavior is active
// create a sphere centered at the origin with radius of 1
// BoundingSphere bounds = new BoundingSphere();
// rotator.setSchedulingBounds(bounds); trsgp_arr[2].addChild(rotator);
//------------- 자동회전 -------------------------------------


/*
DirectionalLight lightD = new DirectionalLight();
lightD.setDirection(new Vector3f(0.0f,-0.7f,-0.7f));
lightD.setInfluencingBounds(bounds);
contentRoot.addChild(lightD);

AmbientLight lightA = new AmbientLight();
lightA.setInfluencingBounds(bounds);
contentRoot.addChild(lightA);

Background background = new Background();
background.setColor(1.0f, 1.0f, 1.0f);
background.setApplicationBounds(bounds);
contentRoot.addChild(background);
*/
// Let Java 3D perform optimizations on this scene graph.
// contentRoot.compile();

return contentRoot;

}//------------ end void car_mk -------------------------

//------------- GeomInfoApp -------------- end ----------------------------

public Shape3D ex_axisXYZ(){//---

Shape3D plane = new Shape3D();
int tab[]=new int[3]; tab[0]=2; tab[1]=2; tab[1]=2;
LineArray axisXYZ=new LineArray(70,LineArray.COORDINATES|LineArray.COLOR_3 );
axisXYZ.setCoordinate(0,new Point3f(-100f,0f,0f));// x axis
axisXYZ.setCoordinate(1,new Point3f(+100f,0f,0f));
axisXYZ.setCoordinate(2,new Point3f( 0f,0f,0f));// y axis
axisXYZ.setCoordinate(3,new Point3f( 0f,10f,0f));
axisXYZ.setCoordinate(4,new Point3f( 0f,0f,-100f));// z axis
axisXYZ.setCoordinate(5,new Point3f( 0f,0f,+100f));

axisXYZ.setCoordinate(6,new Point3f( 1f,0f, 0f));// y axis
axisXYZ.setCoordinate(7,new Point3f( 1f,0.5f, 0f));
axisXYZ.setCoordinate(8,new Point3f( 0f,0f, 1f));// y axis
axisXYZ.setCoordinate(9,new Point3f( 0f,0.5f, 1f));
axisXYZ.setCoordinate(10,new Point3f(-1f,0f, 0f));// y axis
axisXYZ.setCoordinate(11,new Point3f(-1f,0.5f, 0f));
axisXYZ.setCoordinate(12,new Point3f( 0f,0f, -1f));// y axis
axisXYZ.setCoordinate(13,new Point3f( 0f,0.5f,-1f));

for(int i=0;i<6;i++) { axisXYZ.setColor(i,new Color3f( Color.yellow) ); }
for(int i=6;i<13;i++) { axisXYZ.setColor(i,new Color3f( Color.green) ); }
// axisXYZ.setColor(0,new Color3f(1f,0f,0f));
// axisXYZ.setColor(1,new Color3f(0f,0f,1f));
axisXYZ.setColor(2,new Color3f(1f,0f,0f)); // y
axisXYZ.setColor(3,new Color3f(1f,0f,0f));

float t1=1.0f, t2=0f ;
for( int i=14;i<66; i=i+4 ) {
axisXYZ.setCoordinate(i, new Point3f( 0f, t2,0f )); //y
axisXYZ.setCoordinate(i+1,new Point3f( 1f,t2,0f)); //y
axisXYZ.setColor(i, new Color3f( Color.cyan ) );
axisXYZ.setColor(i+1,new Color3f( Color.red ) );

axisXYZ.setCoordinate(i+2, new Point3f( 0f, t2,0f )); //z
axisXYZ.setCoordinate(i+3, new Point3f( 0f ,t2,1f)); //z
axisXYZ.setColor(i+2, new Color3f( Color.yellow ) );
axisXYZ.setColor(i+3, new Color3f( Color.yellow ) );
t2=t2+t1;
}//----- end for ------


plane.setGeometry( axisXYZ ); return plane;
}//--------- end public Shape3D ex_TriangleStripArray(){//------

//---------------- object arr. Transform3D ------ begin ------------------------------------


public void object_arr_Transform_c2_by_ms_release_upgrade3() { //-----

object_dou_arr[obj_nu][1] = oatcb_6 ; //rotate x
object_dou_arr[obj_nu][2] = oatcb_7 ; //rotate y
object_dou_arr[obj_nu][3] = oatcb_8 ; //rotate z
object_dou_arr[obj_nu][0] = oatcb_9 ; //scale y
object_dou_arr[obj_nu][4] = oatcb_1 ; //locate x
object_dou_arr[obj_nu][5] = oatcb_2 ; //locate y
object_dou_arr[obj_nu][6] = oatcb_3 ; //locate z


}//------ end void void object_arr_Transform_c2_by_ms_release_upgrade3() { //-----


public void object_arr_Transform_c2_by_ms_upgrade3() { //-----

oatcb_6 = ( object_dou_arr[obj_nu][1] ); //x
oatcb_7 = ( object_dou_arr[obj_nu][2] ); //y
oatcb_8 = ( object_dou_arr[obj_nu][3] ); //z

if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) // button1
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) == 0) ){ // rotate x,y
oatcb_6 = ( object_dou_arr[obj_nu][1] + ms_c2_x_delta );
oatcb_7 = ( object_dou_arr[obj_nu][2] + ms_c2_y_delta );
}//------------ end if ( ((mevt.getModifiers() //----------

// if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) == 0) // button3
// && ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ // rotate x,y
// oatcb_6 = ( object_dou_arr[obj_nu][1] + ms_c2_x_delta );
// oatcb_7 = ( object_dou_arr[obj_nu][2] + ms_c2_y_delta );
// }//------------ end if ( ((mevt.getModifiers() //----------

if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0)
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ // rotate z,y
oatcb_8 = ( object_dou_arr[obj_nu][3] + ms_c2_x_delta ); //z
}//------------ end if ( ((mevt.getModifiers() //----------

double oatcb_6_rad = rad_a * oatcb_6 ;
double oatcb_7_rad = rad_a * oatcb_7 ;
double oatcb_8_rad = rad_a * oatcb_8 ;

//--------------------- scale setting --------------- begin ---------------------
oatcb_9 = object_dou_arr[obj_nu][0] ; //scale

/*
double temp7_scale = trs3d_arr[obj_nu].getScale();
oatcb_9 = object_dou_arr[obj_nu][0] ; //scale
if ( ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) ){
if ( temp7_scale > 20d ) { object_dou_arr[obj_nu][0] = 20d ;oatcb_9=20d; }
oatcb_9 = object_dou_arr[obj_nu][0] + ms_c2_y_delta/20d ; //scale
}//------end if ----
*/
double d_temp7 = object_dou_arr[obj_nu][0] ; //scale
if ( ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) ){
oatcb_9 = object_dou_arr[obj_nu][0] + (d_temp7 * (ms_c2_y_delta/100d) ) ; //scale
}//------- end if -----

//--------------------- scale setting --------------- end -----------------------


oatcb_1 = object_dou_arr[obj_nu][4] ; // location x
oatcb_2 = object_dou_arr[obj_nu][5] ; // location y
oatcb_3 = object_dou_arr[obj_nu][6] ; // location z

if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) == 0)
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-----------
oatcb_1 = object_dou_arr[obj_nu][4] + ms_c2_x_delta*move_scale ; // location x
// oatcb_2 = object_dou_arr[obj_nu][5] ; // location y
oatcb_3 = object_dou_arr[obj_nu][6] + ms_c2_y_delta*move_scale ; // location z
}//------end if ----


if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) //; l,r button
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-----------
// oatcb_1 = object_dou_arr[obj_nu][4] ; // location x
oatcb_2 = object_dou_arr[obj_nu][5] + -ms_c2_y_delta*move_scale ; // location y
// oatcb_3 = object_dou_arr[obj_nu][6] ; // location z
}//------------ end if ( ((mevt.getModifiers() -------------------

Vector3d tmp_v3d = new Vector3d( oatcb_1, oatcb_2, oatcb_3 );
trs3d_arr[obj_nu].set( tmp_v3d );
trs3d_arr[obj_nu].setScale( oatcb_9 );
Transform3D temp = new Transform3D();
temp.rotY( oatcb_6_rad ); trs3d_arr[obj_nu].mul(temp);
temp.rotX( oatcb_7_rad ); trs3d_arr[obj_nu].mul(temp);
temp.rotZ( oatcb_8_rad ); trs3d_arr[obj_nu].mul(temp);
/*
//--------------- 오일러를 적용한 회전 --------------- begin -----------------
Vector3d tmp_v3d = new Vector3d( oatcb_1, oatcb_2, oatcb_3 );
trs3d_arr[obj_nu].set( tmp_v3d );
trs3d_arr[obj_nu].setScale( oatcb_9 );
// trs3d_arr[obj_nu].rotY( oatcb_6_rad );
// trs3d_arr[obj_nu].setEuler( new Vector3d(oatcb_7_rad, oatcb_6_rad, oatcb_8_rad) );
Transform3D temp = new Transform3D();
temp.set( oatcb_9 ); trs3d_arr[obj_nu].mul(temp);
temp.setEuler( new Vector3d(oatcb_7_rad, oatcb_6_rad, oatcb_8_rad) );trs3d_arr[obj_nu].mul(temp);
//--------------- 오일러를 적용한 회전 --------------- end -------------------
*/

trsgp_arr[obj_nu].setTransform( trs3d_arr[obj_nu] );

}//------- end void object_arr_Transform_c2_by_ms_upgrade3() { //-----


public void object_arr_Transform_c2_by_ms_wheel_scale_upgrade3() { //-----
//ref--> void object_arr_Transform_c2_by_ms_upgrade3()

oatcb_6 = ( object_dou_arr[obj_nu][1] ); //x
oatcb_7 = ( object_dou_arr[obj_nu][2] ); //y
oatcb_8 = ( object_dou_arr[obj_nu][3] ); //z

double oatcb_6_rad = rad_a * oatcb_6 ;
double oatcb_7_rad = rad_a * oatcb_7 ;
double oatcb_8_rad = rad_a * oatcb_8 ;

//double temp7_scale = trs3d_arr[obj_nu].getScale();
oatcb_9 = object_dou_arr[obj_nu][0] ; //scale
double d_temp7 = 1d ;
if ( mouse_wheel_drection == 1 ) { d_temp7 = oatcb_9/ 10d ; }
if ( mouse_wheel_drection == -1 ) { d_temp7 = oatcb_9/-10d ; }

oatcb_9 = object_dou_arr[obj_nu][0] + d_temp7 ; //scale

oatcb_1 = object_dou_arr[obj_nu][4] ; // location x
oatcb_2 = object_dou_arr[obj_nu][5] ; // location y
oatcb_3 = object_dou_arr[obj_nu][6] ; // location z

Vector3d tmp_v3d = new Vector3d( oatcb_1, oatcb_2, oatcb_3 );
trs3d_arr[obj_nu].set( tmp_v3d );
trs3d_arr[obj_nu].setScale( oatcb_9 );
Transform3D temp = new Transform3D();
temp.rotY( oatcb_6_rad ); trs3d_arr[obj_nu].mul(temp);
temp.rotX( oatcb_7_rad ); trs3d_arr[obj_nu].mul(temp);
temp.rotZ( oatcb_8_rad ); trs3d_arr[obj_nu].mul(temp);

trsgp_arr[obj_nu].setTransform( trs3d_arr[obj_nu] );

object_dou_arr[obj_nu][0] = oatcb_9 ; //scale


}//-------- void object_arr_Transform_c2_by_ms_wheel_scale_upgrade -------


//---------------- object arr. Transform3D ------ end --------------------------------------


public void c2_add_start_set(){//---
frm3df =new Frame("[ see1 ] java 3d v1.1") ;
//{public void paint(Graphics g){System.out.println("윈도우 frm3df");
// if ( c2 != null ){ ViewPlatformTransform_c2_move_by_ms() ; }//-----
// }};//----------

frm3df.setSize(500,300); frm3df.setLocation(11,311);
frm3df.setBackground (Color.cyan); // frm3df.setVisible(true);
//frm3df.setLayout(null);
frm3df.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent et) { System.exit(0);} });

//config = SimpleUniverse.getPreferredConfiguration( );

data_cvs = new Canvas();
data_cvs.setLocation( 5, 30);data_cvs.setSize ( data_cvs_wdth , data_cvs_heit );
data_cvs.setBackground (Color.yellow);
frm3df.add(data_cvs); // data_cvs.setVisible(true);

// create the second canvas, this is used for "see1's" Viewer
c2 = new Canvas3D( config );
//c2.setSize( m_kWidth, m_kHeight );
//c2.setLocation( m_kWidth +20, 50 );
c2.addMouseListener(this);
c2.addMouseMotionListener(this);
c2.addMouseWheelListener(this);
frm3df.add( c2 );

}//------- end void c2_add_start_set(){//------------

public void gear_make(){//-----

}//----------- end void -----
//
private Group buildGadget( )
{
//if( debug ) System.err.println( " gadget..." );
//
// Create two appearances:
// wireframeApp: draw as blue wireframe
// shadedApp: draw as metalic shaded polygons
//

// Wireframe:
// no Material - defaults to coloring attributes color
// polygons as lines, with backfaces
// thick lines
Appearance wireframeApp = new Appearance( );

ColoringAttributes wireframeCatt = new ColoringAttributes( );
wireframeCatt.setColor( 0.0f, 0.2559f, 0.4213f );
wireframeCatt.setShadeModel( ColoringAttributes.SHADE_FLAT );
wireframeApp.setColoringAttributes( wireframeCatt );

PolygonAttributes wireframePatt = new PolygonAttributes( );
wireframePatt.setPolygonMode( PolygonAttributes.POLYGON_LINE );
wireframePatt.setCullFace( PolygonAttributes.CULL_NONE );
wireframeApp.setPolygonAttributes( wireframePatt );

LineAttributes wireframeLatt = new LineAttributes( );
wireframeLatt.setLineWidth( 2.0f );
wireframeApp.setLineAttributes( wireframeLatt );


// Shaded:
// silver material
Appearance shadedApp = new Appearance( );

Material shadedMat = new Material( );
shadedMat.setAmbientColor( 0.30f, 0.30f, 0.30f );
shadedMat.setDiffuseColor( 0.30f, 0.30f, 0.50f );
shadedMat.setSpecularColor( 0.60f, 0.60f, 0.80f );
shadedMat.setShininess( 0.10f );
shadedApp.setMaterial( shadedMat );

ColoringAttributes shadedCatt = new ColoringAttributes( );
shadedCatt.setShadeModel( ColoringAttributes.SHADE_GOURAUD );
shadedApp.setColoringAttributes( shadedCatt );


//
// Create a switch group to hold two versions of the
// shape: one wireframe, and one shaded
//
trs3d_arr[1] = new Transform3D( );
trs3d_arr[1].set( new Vector3f( -1.0f, 4.2f, 0.0f ) );
trsgp_arr[1] = new TransformGroup( trs3d_arr[1] );
trsgp_arr[1].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
trsgp_arr[1].setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

object_dou_arr[1][0]= 1d; //scale
object_dou_arr[1][1]= 0d; //rotate
object_dou_arr[1][4]= -1.0d; //locate
object_dou_arr[1][5]= 4.2d; //locate
object_dou_arr[1][6]= 0.0d; //locate

shadingSwitch = new Switch( );
shadingSwitch.setCapability( Switch.ALLOW_SWITCH_WRITE );
Group wireframe = new Group( );
Group shaded = new Group( );
shadingSwitch.addChild( wireframe );
shadingSwitch.addChild( shaded );
shadingSwitch.setWhichChild( 1 ); // shaded
trsgp_arr[1].addChild( shadingSwitch );


//
// Build a gear (wireframe and shaded)
//
trs3d_arr[1] = new Transform3D( );
trs3d_arr[1].rotY( Math.PI/2.0 );
TransformGroup tg = new TransformGroup( trs3d_arr[1] );
SpurGear gear = new SpurGearThinBody(
24, // tooth count
1.6f, // pitch circle radius
0.3f, // shaft radius
0.08f, // addendum
0.05f, // dedendum
0.3f, // gear thickness
0.28f, // tooth tip thickness
wireframeApp );// appearance
tg.addChild( gear );
wireframe.addChild( tg );

tg = new TransformGroup( trs3d_arr[1] );
gear = new SpurGearThinBody(
24, // tooth count
1.6f, // pitch circle radius
0.3f, // shaft radius
0.08f, // addendum
0.05f, // dedendum
0.3f, // gear thickness
0.28f, // tooth tip thickness
shadedApp ); // appearance
tg.addChild( gear );
shaded.addChild( tg );


//
// Build another gear (wireframe and shaded)
//
trs3d_arr[1].rotY( Math.PI/2.0 );
Vector3f trans = new Vector3f( -0.5f, 0.0f, 0.0f );
trs3d_arr[1].setTranslation( trans );
tg = new TransformGroup( trs3d_arr[1] );
gear = new SpurGearThinBody(
30, // tooth count
2.0f, // pitch circle radius
0.3f, // shaft radius
0.08f, // addendum
0.05f, // dedendum
0.3f, // gear thickness
0.28f, // tooth tip thickness
wireframeApp );// appearance
tg.addChild( gear );
wireframe.addChild( tg );

tg = new TransformGroup( trs3d_arr[1] );
gear = new SpurGearThinBody(
30, // tooth count
2.0f, // pitch circle radius
0.3f, // shaft radius
0.08f, // addendum
0.05f, // dedendum
0.3f, // gear thickness
0.28f, // tooth tip thickness
shadedApp ); // appearance
tg.addChild( gear );
shaded.addChild( tg );


//
// Build a cylindrical shaft (wireframe and shaded)
//
trs3d_arr[1].rotZ( -Math.PI/2.0 );
trans = new Vector3f( 1.0f, 0.0f, 0.0f );
trs3d_arr[1].setTranslation( trans );
tg = new TransformGroup( trs3d_arr[1] );
Cylinder cyl = new Cylinder(
0.3f, // radius
4.0f, // length
Primitive.GENERATE_NORMALS, // format
16, // radial resolution
1, // length-wise resolution
wireframeApp );// appearance
tg.addChild( cyl );
wireframe.addChild( tg );

tg = new TransformGroup( trs3d_arr[1] );
cyl = new Cylinder(
0.3f, // radius
4.0f, // length
Primitive.GENERATE_NORMALS, // format
16, // radial resolution
1, // length-wise resolution
shadedApp ); // appearance
tg.addChild( cyl );
shaded.addChild( tg );


//
// Build shaft teeth (wireframe and shaded)
//
trs3d_arr[1].rotY( Math.PI/2.0 );
trans = new Vector3f( 2.05f, 0.0f, 0.0f );
trs3d_arr[1].setTranslation( trans );
tg = new TransformGroup( trs3d_arr[1] );
gear = new SpurGear(
12, // tooth count
0.5f, // pitch circle radius
0.3f, // shaft radius
0.05f, // addendum
0.05f, // dedendum
1.5f, // gear thickness
0.8f, // tooth tip thickness
wireframeApp );// appearance
tg.addChild( gear );
wireframe.addChild( tg );

tg = new TransformGroup( trs3d_arr[1] );
gear = new SpurGear(
12, // tooth count
0.5f, // pitch circle radius
0.3f, // shaft radius
0.05f, // addendum
0.05f, // dedendum
1.5f, // gear thickness
0.8f, // tooth tip thickness
shadedApp ); // appearance
tg.addChild( gear );
shaded.addChild( tg );

return trsgp_arr[1];
}//-----------------------


public void add_multy_geometric(){//----- 새로운 도형 추가 -----------

trs3d_arr[0] = new Transform3D(); trs3d_arr[0].set(new Vector3f(0.0f, 1.0f, 0.0f));
//Transform3D temp = new Transform3D();
//temp.rotX(Math.PI/4.0d);trs3d_arr[0].mul(temp); temp.rotY(Math.PI/4.0d); trs3d_arr[0].mul(temp);
trs3d_arr[0].setScale(3.1);

object_dou_arr[0][0]= 4d; //scale
object_dou_arr[0][1]= 0d; //rotate
object_dou_arr[0][4]= 0.0d; //locate
object_dou_arr[0][5]= 1.0d; //locate
object_dou_arr[0][6]= 0.0d; //locate

trsgp_arr[0] = new TransformGroup(trs3d_arr[0]);
trsgp_arr[0].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
trsgp_arr[0].setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

trsgp_arr[0].addChild(createPyramid ());
bg.addChild(trsgp_arr[0]);

//trs_pyrmd_.addChild( new Label3D( 6.2f, 6.2f, 6.0f, "ColorCube") ); // add a label to the scene

// bg.addChild ( createPyramid () );

Shape3D textObject = new Text2D(" Colorful Pyramid ",
new Color3f(0f, 0f, 1f),"Serif",60,Font.BOLD);
Appearance app = textObject.getAppearance();
PolygonAttributes pa = app.getPolygonAttributes();
if (pa == null){ pa = new PolygonAttributes(); };pa.setCullFace(PolygonAttributes.CULL_NONE);
if (app.getPolygonAttributes() == null){ app.setPolygonAttributes(pa);}
trsgp_arr[0].addChild(textObject);



//-----------------------------------------------------------------------------------------------
Transform3D trs3d2 = new Transform3D();trs3d2.set(new Vector3f(-8.0f, 1.3f, -2.0f));
trs3d2.setScale(5.1);
TransformGroup trans2 = new TransformGroup(trs3d2);
bg.addChild(trans2);
Shape3D textObject2 = new Text2D(" [2005] Java 3d Program by Choi. mh ",
new Color3f(1f, 1f, 0f),"Serif",60,Font.BOLD);

Appearance app2 = textObject2.getAppearance();
PolygonAttributes pa2 = app2.getPolygonAttributes();
if (pa2 == null){ pa2 = new PolygonAttributes(); };pa2.setCullFace(PolygonAttributes.CULL_NONE);
if (app2.getPolygonAttributes() == null){ app2.setPolygonAttributes(pa2);}

trans2.addChild(textObject2);
//----------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------

Transform3D trs3d3 = new Transform3D();trs3d3.set(new Vector3f( 0.0f, 5.3f, -2.0f));
trs3d3.setScale(5.1);
TransformGroup trans3 = new TransformGroup(trs3d3);
bg.addChild(trans3);
Shape3D textObject3 = new Text2D(" Spur Gear ",
new Color3f(1f, 1f, 0f),"Serif",90,Font.BOLD);

Appearance app3 = textObject3.getAppearance();
PolygonAttributes pa3 = app3.getPolygonAttributes();
if (pa3 == null){ pa3 = new PolygonAttributes(); };pa3.setCullFace(PolygonAttributes.CULL_NONE);
if (app3.getPolygonAttributes() == null){ app3.setPolygonAttributes(pa3);}

trans3.addChild(textObject3);
//-----------------------------------------------------------------------------------------------

//shadingSwitch.setWhichChild( 1 ); // shaded
// shadingSwitch.setWhichChild( 0 ); // wire
bg.addChild( buildGadget( ) );
bg.addChild( ex_axisXYZ() );
bg.addChild( new CheckerFloor().getBG() ); // add the floor
// loadModel( "models/Head.3DS" ) ;

}//---------- end void add_multy_geometric(){//-----

public Shape3D createPyramid(){//------------------


// Creation des sommets et de leur couleur
Point3f s0 = new Point3f (0, 0.5f, 0);
Point3f s1 = new Point3f (0, -0.5f, 0.7f);
Point3f s2 = new Point3f (0.7f, -0.5f, -0.3f);
Point3f s3 = new Point3f (-0.7f, -0.5f, -0.3f);
Color3f s0Color = new Color3f (1, 0, 0); // Rouge
Color3f s1Color = new Color3f (0, 1, 0); // Vert
Color3f s2Color = new Color3f (0, 0, 1); // Bleu
Color3f s3Color = new Color3f (1, 1, 0); // Jaune

// Construction de 2 eventails avec les points et leur couleur
GeometryInfo geometryInfo = new GeometryInfo (GeometryInfo.TRIANGLE_FAN_ARRAY);
geometryInfo.setCoordinates (new Point3f [ ] {s0, s1, s2, s3, s1,
s2, s1, s3});
geometryInfo.setColors (new Color3f [ ] {s0Color, s1Color, s2Color, s3Color, s1Color,
s2Color, s1Color, s3Color});
geometryInfo.setStripCounts (new int [ ] {5, 3});

// Forme creee avec cette construction geometrique
// return new Shape3D (geometryInfo.getIndexedGeometryArray ());

Shape3D plane = new Shape3D (geometryInfo.getIndexedGeometryArray ());


Appearance app_prmd = new Appearance();
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(ta.BLENDED);
ta.setTransparency(0.3f);
app_prmd.setTransparencyAttributes(ta);

plane.setAppearance(app_prmd);

return plane;

}//----------- end public Shape3D createPyramid () ----


public void object_arr_init(){//----
object_name_arr[0] ="pyramid "; object_name_arr[1] ="gear"; object_name_arr[2] ="car";


for( int i = 0; i < object_max ; i++) {
for( int j = 0; j < object_y2_max ; j++) {
object_dou_arr[i][j] = 0 ;
}};

}//---------

public void add_button(){//----------
int btn_x=90 , btn_y=25 ;

view_move_btn = new Button("see 1 move");
view_move_btn.setLocation( 10,m_kHeight +5+10 );
view_move_btn.setSize ( btn_x,btn_y );
view_move_btn.setBackground (Color.red );
view_move_btn.addActionListener(this);
add(view_move_btn);

view_rotate_btn = new Button("see 1 rotate");
view_rotate_btn.setLocation( 10+100 ,m_kHeight +5+ 10 );
view_rotate_btn.setSize ( btn_x,btn_y );
view_rotate_btn.setBackground (Color.yellow );
view_rotate_btn.addActionListener( this );
add(view_rotate_btn);


object_rotate_btn = new Button("object rotate");
object_rotate_btn.setLocation( 10+200 ,m_kHeight +5+ 10 );
object_rotate_btn.setSize ( btn_x,btn_y );
object_rotate_btn.setBackground (Color.yellow );
object_rotate_btn.addActionListener( this );
add(object_rotate_btn);


ds3_dxf_btn = new Button("3ds,dxf Load");
ds3_dxf_btn.setLocation( 10,m_kHeight +5+10+btn_y+5 );
ds3_dxf_btn.setSize ( btn_x,btn_y );
ds3_dxf_btn.setBackground (Color.yellow );
ds3_dxf_btn.addActionListener(this);
add(ds3_dxf_btn);


choice = new Choice();
Choice choice2 = new Choice();
//myChoice.addItem("관우");
choice.add( object_name_arr[0] );choice2.add(" " );
choice.add( object_name_arr[1] );choice2.add(" " );
choice.add( object_name_arr[2] );
choice.setBackground(Color.lightGray);choice2.setBackground(Color.green);
choice.addItemListener(this);
choice.setLocation( 10+300 ,m_kHeight +5+ 10 );
choice.select( object_name_arr[0] ) ;
obj_nu = 0 ;
add(choice);//add(choice2);


popup_cvs = new Canvas()
{public void paint(Graphics g){ //System.out.println("윈도우 cvs ");
if ( popup_cvs != null ){//-----
Graphics gg_cvs = popup_cvs.getGraphics(); gg_cvs.setColor(Color.cyan);
gg_cvs.fillRect( 0,0, 90,25 );
gg_cvs.setColor( Color.black );
gg_cvs.drawString("--- Menu ---",7,20 );
}//---endif ( popup_cvs != null )//-----

}};//------ end void paint( -----

popup_cvs.setSize( btn_x,btn_y );
popup_cvs.setLocation( 10+100 ,m_kHeight +5+10+btn_y+5 );
popup_cvs.setBackground (Color.cyan);
popup_cvs.addMouseListener(this);
popup_cvs.addMouseMotionListener(this);

add( popup_cvs );
w8_5_popup_init() ;//---


}//------- end void add_button(){//----------

public void get_now_cvs_original() {
get_now_cvs = " " ;
if( mevt.getSource() == c1 ) { get_now_cvs = "cvs1" ;}
if( mevt.getSource() == c2 ) { get_now_cvs = "cvs2" ;}
if( mevt.getSource() == c3 ) { get_now_cvs = "cvs3" ;}

//System.out.println( "get_now_cvs = "+get_now_cvs );

}//-------- end void get_now_cvs_original() { ---------

public void object_gear_Transform_c2_by_ms() { //-----

double d_temp6 = rad_a * ms_c2_x_delta ; double d_temp7 = rad_a * ms_c2_y_delta ;
Transform3D temp = new Transform3D();

if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){
temp.rotY( d_temp6 );trs3d_arr[1].mul(temp); temp.rotX( d_temp7 ); trs3d_arr[1].mul(temp); }//----

double temp7_scale = trs3d_arr[1].getScale();
if ( (ms_c2_y_delta > 0) && ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) && temp7_scale < 5d ){
temp.setScale( 1.15 ); trs3d_arr[1].mul(temp);}
if ( (ms_c2_y_delta < 0) && ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) && temp7_scale > 0.1d ){
temp.setScale( 0.95 ); trs3d_arr[1].mul(temp);}


if ( ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){//----------
// temp.set(new Vector3f(0.0f, 1.0f, 0.0f));
temp.set(new Vector3d( ms_c2_y_delta*move_scale,0d,ms_c2_x_delta*move_scale )); trs3d_arr[1].mul(temp);
}//----

trsgp_arr[1].setTransform( trs3d_arr[1] );
System.out.println("object_rotate="+ d_temp6+","+d_temp7 );
System.out.println(" trs3d_arr[1].getScale()="+ trs3d_arr[1].getScale() );

}//---- end void object_gear_Transform_c2_by_ms() { //-----


public void object_pyramid_Transform_c2_by_ms() { //-----

// double d_temp6 = rad_a * ( ms_c2_x_delta + pyrmd_ms_x_rot_old ) ;
// double d_temp7 = rad_a * ( ms_c2_y_delta + pyrmd_ms_y_rot_old ) ;

double d_temp6 = rad_a * ms_c2_x_delta ; double d_temp7 = rad_a * ms_c2_y_delta ;
Transform3D temp = new Transform3D();

if ( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){
temp.rotY( d_temp6 );trs3d_arr[0].mul(temp); temp.rotX( d_temp7 ); trs3d_arr[0].mul(temp); }//----

double temp7_scale = trs3d_arr[0].getScale();
if ( (ms_c2_y_delta > 0) && ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) && temp7_scale < 20d ){
temp.setScale( 1.15 ); trs3d_arr[0].mul(temp);}
if ( (ms_c2_y_delta < 0) && ((mevt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) && temp7_scale > 0.1d ){
temp.setScale( 0.95 ); trs3d_arr[0].mul(temp);}


if ( ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){//----------
// temp.set(new Vector3f(0.0f, 1.0f, 0.0f));
temp.set(new Vector3d( ms_c2_x_delta*move_scale,0d,ms_c2_y_delta*move_scale )); trs3d_arr[0].mul(temp);
}//----


trsgp_arr[0].setTransform( trs3d_arr[0] );
// vp2_c2.getViewingPlatform().getViewPlatformTransform().setTransform( trs3d_arr[0] );
//vp2_c2.getViewPlatformTransform( ).setTransform( trs3d_arr[0] );
// vp2_c2.getViewingPlatform(trsgp_arr[0]);
System.out.println("object_rotate="+ d_temp6+","+d_temp7 );
System.out.println(" trs3d_arr[0].getScale()="+ trs3d_arr[0].getScale() );
//System.out.println(" trs3d_arr[0].getScale()="+ trs3d_arr[0].getRotX() );

}//---- end void object_pyramid_Transform_c2_by_ms() { //-----

public void object_pyramid_Transform_c2_by_ms_upgrade2() { //-----
// trs3d_arr[0].set(new Vector3d( ms_c2_x_delta*move_scale,0d,ms_c2_y_delta*move_scale ));
trs3d_arr[0].set(new Vector3d( 0d,0d,0d ) );
trs3d_arr[0].setScale(5.0);

double d_temp6 = rad_a * ms_c2_x_delta ; double d_temp7 = rad_a * ms_c2_y_delta ;
Transform3D temp = new Transform3D();
temp.rotY( d_temp6 );trs3d_arr[0].mul(temp); temp.rotX( d_temp7 ); trs3d_arr[0].mul(temp);

trsgp_arr[0].setTransform( trs3d_arr[0] );

}//------- end void object_pyramid_Transform_c2_by_ms_upgrade2() { //-----

public void object_Transform_x_rotae_c2_by_ms() { //-----
//vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );
double d_temp6 = rad_a * ( ms_c2_x_delta + pyrmd_ms_x_rot_old ) ;
trs3d_arr[0].rotY( d_temp6 );
trsgp_arr[0].setTransform( trs3d_arr[0] );

// double get2[] = new double [20];
// get2 =trs3d_arr[0].get();

System.out.println("ms_c2_x_delta + pyrmd_ms_x_rot_old="+ (ms_c2_x_delta + pyrmd_ms_x_rot_old) );
}//---- end void { //-----

public void object_Transform_y_rotae_c2_by_ms() { //-----
double d_temp7 = rad_a * ( ms_c2_y_delta + pyrmd_ms_y_rot_old ) ;
trs3d_arr[0].rotX( d_temp7 );
trsgp_arr[0].setTransform( trs3d_arr[0] );
System.out.println("ms_c2_y_delta + pyrmd_ms_y_rot_old="+ (ms_c2_y_delta + pyrmd_ms_y_rot_old) );
}//---- end void //-----

public void object_Transform_scale_c2_by_ms() { //-----

double d_temp6 = rad_a * ( ms_c2_x_delta + pyrmd_ms_x_rot_old ) ;
double d_temp7 = rad_a * ( ms_c2_y_delta + pyrmd_ms_y_rot_old ) ;
if ( ms_c2_x_delta > 0 ){ trs3d_arr[0].setScale(3.1 * ( ms_c2_x_delta/5d) ); }
if ( ms_c2_x_delta < 0 ){ trs3d_arr[0].setScale(3.1 * (1/(-ms_c2_x_delta/5d) ) ); }
System.out.println(" trs3d_arr[0].getScale()="+ trs3d_arr[0].getScale() );
trsgp_arr[0].setTransform( trs3d_arr[0] );

}//---- end void //-----

public void cvs2_view_move_BUTTON1(){//

ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c2_x_delta = -ms_delta_x / 1 ; ms_c2_y_delta = ms_delta_y * move_scale ;

if ( ms_delta_x > 3 || ms_delta_x < -3 ) {//-----
ms_start_x = mevt.getX(); ms_start_y = mevt.getY();
ViewPlatformTransform_mouseReleased() ;
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c2_x_delta = -ms_delta_x / 1 ; ms_c2_y_delta = ms_delta_y * move_scale ;
}//------- end if ( ms_delta_x > 3 || ms_delta_x < -3 ) -----------

ViewPlatformTransform_c2_move_by_ms() ;

}//-------- end void cvs2_view_move_BUTTON1(){// ----


//--------------------- ViewPlatformTransform c2 rotate ------ begin ----------------------------

public void ViewPlatformTransform_c2_rotate_by_ms() { //-----
//ref. ---> void ViewPlatformTransform_c2_move_by_ms() { //-----

double d_temp6 = rad_a * ( ms_c2_x_delta + ms_c2_x_rot_old ) ;
double d_temp7 = rad_a * ( ms_c2_y_delta + c2_view_rot_y_old ) ;
// t3d_c2_by_ms.rotY( d_temp6 ); t3d_c2_by_ms.rotX( d_temp7 );

//-----------------------------------------------------------------------------------
double y_c2_move_btn_old_temp = y_c2_move_btn_old ;//+ ms_c2_y_delta ;
double z_c2_move_btn_old_temp = z_c2_move_btn_old + x_move ;
double x_c2_move_btn_old_temp = x_c2_move_btn_old + z_move ;
//----------------------------------------------------------------------------------


// t3d_c2_by_ms.setTranslation( new Vector3d( //이기능은 벡터를 초기화하지 못한다 ----
t3d_c2_by_ms.set( new Vector3d(
// x_c2_move_btn_old , y_c2_move_btn_old , z_c2_move_btn_old ) );
z_c2_move_btn_old_temp , y_c2_move_btn_old_temp , x_c2_move_btn_old_temp ) );
// t3d_c2_by_ms.setScale( 1d );

Transform3D temp = new Transform3D();
temp.rotY( d_temp6 ); t3d_c2_by_ms.mul(temp);
temp.rotX( d_temp7 ); t3d_c2_by_ms.mul(temp);


//trans3.setTransform(t3d_c2_by_ms);
//vp2_c2.setViewPlatformTransform( ).setTransform( t3d_c2_by_ms );
vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );
//vp2_c2.setTransform( t3d_c2_by_ms );
//vp2_c2.setNominalViewingTransform().setTransform( t3d_c2_by_ms );

Graphics gg_cvs = data_cvs.getGraphics(); gg_cvs.setColor(Color.yellow);
gg_cvs.fillRect( 0,0, data_cvs_wdth , data_cvs_heit );
gg_cvs.setColor( Color.black );
gg_cvs.drawString("x,y,z=["
+ dcfm2.format( x_c2_move_btn_old_temp )+" ,"
+ dcfm2.format( y_c2_move_btn_old_temp )+" ,"
+ dcfm2.format( z_c2_move_btn_old_temp )+"]" , 0,16 );
gg_cvs.drawString("Y rotate =["+ dcfm3.format( ms_c2_x_delta + ms_c2_x_rot_old )+"]" , 0,32 );
gg_cvs.drawString("X rotate =["+ dcfm3.format( ms_c2_y_delta + c2_view_rot_y_old )+"]" , 0,48 );

}//--------end void ViewPlatformTransform_c2_rotate_by_ms() { //-----

public void cvs2_view_rotate_BUTTON1(){//

ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c2_x_delta = -ms_delta_x / 1 ; ms_c2_y_delta = -ms_delta_y / 1d ;

ViewPlatformTransform_c2_rotate_by_ms() ;

}//-------- end void cvs2_view_rotate_BUTTON1(){// ----

//--------------------- ViewPlatformTransform c2 rotate ------ end ------------------------------

public void ViewPlatformTransform_c2_rotate_by_ms_wheel() { //-----
//ref. ---> void ViewPlatformTransform_c2_rotate_by_ms() { //-----
//ref. ---> void ViewPlatformTransform_c2_move_by_ms() { //-----

double angle_temp7 = 1d ;
if ( mouse_wheel_drection == 1 ) { angle_temp7 = 3d ; }
if ( mouse_wheel_drection == -1 ) { angle_temp7 = -3d ; }

double d_temp6 = rad_a * ( 0 + ms_c2_x_rot_old ) ;
double d_temp7 = rad_a * ( angle_temp7 + c2_view_rot_y_old ) ;
// t3d_c2_by_ms.rotY( d_temp6 ); t3d_c2_by_ms.rotX( d_temp7 );

//-----------------------------------------------------------------------------------
double y_c2_move_btn_old_temp = y_c2_move_btn_old ;//+ ms_c2_y_delta ;
double z_c2_move_btn_old_temp = z_c2_move_btn_old + x_move ;
double x_c2_move_btn_old_temp = x_c2_move_btn_old + z_move ;
//----------------------------------------------------------------------------------

t3d_c2_by_ms.set( new Vector3d(
z_c2_move_btn_old_temp , y_c2_move_btn_old_temp , x_c2_move_btn_old_temp ) );

Transform3D temp = new Transform3D();
temp.rotY( d_temp6 ); t3d_c2_by_ms.mul(temp);
temp.rotX( d_temp7 ); t3d_c2_by_ms.mul(temp);

vp2_c2.getViewPlatformTransform( ).setTransform( t3d_c2_by_ms );

Graphics gg_cvs = data_cvs.getGraphics(); gg_cvs.setColor(Color.yellow);
gg_cvs.fillRect( 0,0, data_cvs_wdth , data_cvs_heit );
gg_cvs.setColor( Color.black );
gg_cvs.drawString("x,y,z=["
+ dcfm2.format( x_c2_move_btn_old_temp )+" ,"
+ dcfm2.format( y_c2_move_btn_old_temp )+" ,"
+ dcfm2.format( z_c2_move_btn_old_temp )+"]" , 0,16 );
gg_cvs.drawString("Y rotate =["+ dcfm3.format( 0 + ms_c2_x_rot_old )+"]" , 0,32 );
gg_cvs.drawString("X rotate =["+ dcfm3.format( angle_temp7 + c2_view_rot_y_old )+"]" , 0,48 );

ms_c2_x_rot_old = ms_c2_x_rot_old + 0 ;
c2_view_rot_y_old = c2_view_rot_y_old + angle_temp7 ;


}//--------end void ViewPlatformTransform_c2_rotate_by_ms_wheel() { //-----

public void cvs2_object_rotate(){//------
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c2_x_delta = ms_delta_x ; ms_c2_y_delta = ms_delta_y ;

// if ( choice_str2 == "gear" ) { object_gear_Transform_c2_by_ms(); }
// if ( choice_str2 == "pyramid" ){ object_pyramid_Transform_c2_by_ms(); }
//object_pyramid_Transform_c2_by_ms();
//object_pyramid_Transform_c2_by_ms_upgrade2() ; //-----
object_arr_Transform_c2_by_ms_upgrade3() ; //-----

// object_Transform_x_rotae_c2_by_ms() ; //-----
// object_Transform_y_rotae_c2_by_ms() ; //-----
// object_Transform_scale_c2_by_ms() ; //-----


//ms_start_x = mevt.getX(); ms_start_y = mevt.getY();

}//---- end void cvs2_object_rotate(){//------

public void cvs3_view_move_BUTTON1(){//

ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c3_x_rot = -ms_delta_x / 1 ; ms_c3_y_rot = ms_delta_y * move_scale ;

if ( ms_delta_x > 3 || ms_delta_x < -3 ) {//-----
ms_start_x = mevt.getX(); ms_start_y = mevt.getY();
ViewPlatformTransform_mouseReleased() ;
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c3_x_rot = -ms_delta_x / 1 ; ms_c3_y_rot = ms_delta_y * move_scale ;
}//------- end if ( ms_delta_x > 3 || ms_delta_x < -3 ) ----------

ViewPlatformTransform_c3_move_by_ms() ;

}//-------- end void cvs3_view_move_BUTTON1(){// ----

public void ViewPlatformTransform_canvas_by_ms(){//--------

// if( ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){view_status="view_rotate" ; }
// if( ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){view_status="view_move" ; }
//System.out.println("object_rotate_tf="+object_rotate_tf);

if ( get_now_cvs == "cvs1" ){ //-------
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c1_x_rot = ms_delta_x / 1d ; ms_c1_y_rot = ms_delta_y ;
ViewPlatformTransform_c1_by_ms() ; } //-----


if ( get_now_cvs == "cvs2" && view_status=="view_move" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
cvs2_view_move_BUTTON1() ;//
} //-----end if ( get_now_cvs == "cvs2" ){ //-------


if ( get_now_cvs == "cvs2" && view_status=="view_move" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-------
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c2_x_delta = ms_delta_x * move_scale ; ms_c2_y_delta = -ms_delta_y * move_scale ;
ViewPlatformTransform_c2_button3_move_by_ms() ;
} //-----end if ( get_now_cvs == "cvs2" ){ //-------


if ( get_now_cvs == "cvs2" && view_status=="view_rotate" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
cvs2_view_rotate_BUTTON1() ;//
} //-----end if ( get_now_cvs == "cvs2" ){ //-------


if ( get_now_cvs == "cvs2" && object_rotate_tf==true ){ //-------
cvs2_object_rotate() ;//------
}//------end if ( get_now_cvs == "cvs2" && object_rotate_tf=true ){ //-------


if ( get_now_cvs == "cvs3" && ( view_status=="view_move" || view_status=="view_rotate" )
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
cvs3_view_move_BUTTON1() ; } //-----


if ( get_now_cvs == "cvs3" && ( view_status=="view_move" || view_status=="view_rotate" )
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-------
ms_delta_x = mevt.getX() - ms_start_x;
ms_delta_y = mevt.getY() - ms_start_y;
ms_c3_x_rot = ms_delta_x * move_scale ; ms_c3_y_rot = -ms_delta_y * move_scale ;

ViewPlatformTransform_c3_button3_move_by_ms() ;
} //-----end if ( get_now_cvs == "cvs2" ){ //-------


}//------- end void ViewPlatformTransform_canvas_by_ms(){//--------


public void ViewPlatformTransform_mouseReleased(){//--------

if ( get_now_cvs == "cvs1" ){ //-------
ms_c1_x_rot_old =ms_c1_x_rot + ms_c1_x_rot_old;
ms_c1_y_rot_old =ms_c1_y_rot + ms_c1_y_rot_old;

}//------ end if ( get_now_cvs == "cvs1" ){ //-------

if ( get_now_cvs == "cvs2" && view_status=="view_move" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
ms_c2_x_rot_old = ms_c2_x_rot_old + ms_c2_x_delta ;
// c2_view_rot_x_old = c2_view_rot_x_old + ms_c2_x_delta ;
ms_c2_x_delta = 0d ;
z_move = z_move + z_move_delta ; x_move = x_move + x_move_delta ;
if ( x_move < -see1_move_range ) { x_move = -see1_move_range; };
if ( z_move < -see1_move_range ) { z_move = -see1_move_range; };
if ( x_move > see1_move_range ) { x_move = see1_move_range; };
if ( z_move > see1_move_range ) { z_move = see1_move_range; };
}//----end if ( get_now_cvs == "cvs2" ){ //-------

if ( get_now_cvs == "cvs2" && view_status=="view_move" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-------
z_c2_move_btn_old = z_c2_move_btn_old + z_move_delta ;
x_c2_move_btn_old = x_c2_move_btn_old - x_move_delta ;
y_c2_move_btn_old = y_c2_move_btn_old + ms_c2_y_delta ;
if ( x_c2_move_btn_old < -see1_move_range ) { x_c2_move_btn_old = -see1_move_range; };
if ( z_c2_move_btn_old < -see1_move_range ) { z_c2_move_btn_old = -see1_move_range; };
if ( x_c2_move_btn_old > see1_move_range ) { x_c2_move_btn_old = see1_move_range; };
if ( z_c2_move_btn_old > see1_move_range ) { z_c2_move_btn_old = see1_move_range; };
}//----endif ( get_now_cvs == "cvs2" ){ //-------

if ( get_now_cvs == "cvs2" && object_rotate_tf==true ){ //-------
object_arr_Transform_c2_by_ms_release_upgrade3() ; //-----
//pyrmd_ms_x_rot_old = pyrmd_ms_x_rot_old + ms_c2_x_delta ;
//pyrmd_ms_y_rot_old = pyrmd_ms_y_rot_old + ms_c2_y_delta ;

}//-----end if ( get_now_cvs == "cvs2" && object_rotate_tf==true ){ //-------


if ( get_now_cvs == "cvs2" && view_status=="view_rotate" && object_rotate_tf==false
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
ms_c2_x_rot_old = ms_c2_x_rot_old + ms_c2_x_delta ;
//c2_view_rot_x_old = c2_view_rot_x_old + ms_c2_x_delta ;
c2_view_rot_y_old = c2_view_rot_y_old + ms_c2_y_delta ;
ms_c2_x_delta = 0d ; ms_c2_y_delta = 0;
}//----end if ( get_now_cvs == "cvs2" ){ //-------

if ( get_now_cvs == "cvs3" && ( view_status=="view_move" || view_status=="view_rotate" )
&& ((mevt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) ){ //-------
ms_c3_x_rot_old = ms_c3_x_rot_old + ms_c3_x_rot ;
ms_c3_z_move = ms_c3_z_move + ms_c3_z_move_delta ;
ms_c3_x_move = ms_c3_x_move + ms_c3_x_move_delta ;
if ( ms_c3_x_move < -see2_move_range ) { ms_c3_x_move = -see2_move_range; };
if ( ms_c3_z_move < -see2_move_range ) { ms_c3_z_move = -see2_move_range; };
if ( ms_c3_x_move > see2_move_range ) { ms_c3_x_move = see2_move_range; };
if ( ms_c3_z_move > see2_move_range ) { ms_c3_z_move = see2_move_range; };
}//----end if ( get_now_cvs == "cvs2" ){ //-------


if ( get_now_cvs == "cvs3" && ( view_status=="view_move" || view_status=="view_rotate" )
&& ((mevt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) ){ //-------
z_c3_move_btn_old = z_c3_move_btn_old + ms_c3_z_move_delta ;
x_c3_move_btn_old = x_c3_move_btn_old - ms_c3_x_move_delta ;
y_c3_move_btn_old = y_c3_move_btn_old + ms_c3_y_rot ;
if ( x_c3_move_btn_old < -see2_move_range ) { x_c3_move_btn_old = -see2_move_range; };
if ( z_c3_move_btn_old < -see2_move_range ) { z_c3_move_btn_old = -see2_move_range; };
if ( x_c3_move_btn_old > see2_move_range ) { x_c3_move_btn_old = see2_move_range; };
if ( z_c3_move_btn_old > see2_move_range ) { z_c3_move_btn_old = see2_move_range; };
}//----end if ( get_now_cvs == "cvs2" ){ //-------


}//------- end void ViewPlatformTransform_mouseReleased(){//--------


public static void main( String[] args )
{//--------------
new MainFrame( new dxf_3ds_loder(), (int) (m_kWidth * 2.3), (int) (m_kHeight * 1.3) );
}//--------------

}//----------------------

----------- program -------------- end ---------------------------------

Posted by 최명환7
,