NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 21, 2017, 07:08:04 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Teaching without words. ...Lao Tzu (570-490 BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: how to create a polygon angle in 3D view?  (Read 4239 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: February 14, 2011, 04:51:14 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

how to create a polygon angle in 3D view?

currently i am able to make a polygon in 2D Ejs view.

but when i try to use the same idea to draw a polygon in 3D view of Ejs, it didn't seem to draw it.

may i request for a sample xml that draw a polygon in 3D view of Ejs?

want i am trying to do is to draw a polygon from vector B (magnetic field direction) to vector A (area) in 3D view.

i also attached my xml in case i am not clear


* thetain3D.PNG (10.59 KB, 324x459 - viewed 262 times.)

*** There are 1 more attached files. You need to login to acces it!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: February 14, 2011, 05:37:32 pm » posted from:Taipei,T'ai-pei,Taiwan

For polygon3D:
 you can enter either Data property: which is a [n][3] two dimension array.
Or provide Xdata,Ydata and Zdata.

You should not type in nangle as Data property (remove it, if you want to specify px,py,pz)

Position and Size is used to move the whole polygon (displacement).
Do not need to enter anything inside that group unless you know what you were doing.
(remove all those values)

There are too many GUI elements, I do not know how to fix your ejs source.
Please try it again by yourself!
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: February 14, 2011, 08:37:06 pm » posted from:Singapore,,Singapore

yes i do it Smiley
dcangle = (ctadegree0360+90)*pi/180/(nangle-2);
//dcangle = cta/(n-2);
// px[0] and px[0] define the centre of polygon
px[0]=x0; // for drawing angle polygon
py[0]=y0; //
// if statement to draw polygon angle
for(int i=1;i<nangle;i++){
// c=Math.atan2(y,x)-(i-1)*dcangle; // modify to work drawing from black line
// c=(Math.atan2(y,x))-(i-1)*dcangle;
c = (ctadegree0360+90)*pi/180-(i-1)*dcangle;

// if(c>pi)c-=2*pi; // to overcome pi to -pi problem
 // if(c<-pi)c+=2*pi;
 // else if (c>pi) c-=2*pi;
px=x0+d*Math.cos(c); //
py=y0+d*Math.sin(c); //
}

i am getting better at ejs Smiley


* thetaanglein3d.png (18.6 KB, 329x454 - viewed 276 times.)

*** There are 1 more attached files. You need to login to acces it!
Logged
Pages: [1]   Go Up
  Print  
Teaching without words. ...Lao Tzu (570-490 BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Accelerated charge create electromagnetic wave
Electromagnetism
Fu-Kwun Hwang 1 33729 Last post April 01, 2006, 08:49:47 pm
by rhipple
Ray tracing (polygon: range from 3-32 faces)
Optics
Fu-Kwun Hwang 14 14040 Last post January 13, 2012, 12:02:05 am
by Fu-Kwun Hwang
Ray tracing (polygon: range from 3-32 faces)
optics
ahmedelshfie 1 4098 Last post April 26, 2010, 06:31:13 pm
by ahmedelshfie
How to create a .jar which coul generate .m files
Questions related to EJS
mujer_esponja 5 5386 Last post June 20, 2010, 08:23:37 am
by Fu-Kwun Hwang
Video show you how to create simulation with EJS
Examples for beginner who want to learn EJS
Fu-Kwun Hwang 1 22568 Last post December 23, 2014, 04:38:42 pm
by essays
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.06 seconds with 23 queries.since 2011/06/15