![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: May 2002
Posts: 18
|
I have a table of x, y and z coordinates and was wondering if there is a way to have Excel create a 3-D shape from these vertices values. I would greatly appreciate anyone's help.
Thanks, Serious |
|
|
|
|
|
#2 |
|
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
I know how to convert these yourself, but I don't think Excel will do that for you.
If you're interested, post a reply.
__________________
/Niklas Jansson |
|
|
|
|
|
#3 |
|
Join Date: May 2002
Posts: 18
|
Yes, I am interested. I would appreciate your ideas.
|
|
|
|
|
|
#4 |
|
Join Date: May 2002
Posts: 18
|
What program would you use?
|
|
|
|
|
|
#5 |
|
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
You could use any program you like. If you really need to do 3D, you should probably use AutoCAD or something like that, all I can tell you is some conversions and such.
I must tell you, though - it is complicated mathematic behind. You need to convert "World Data" to "Camera Data". Do you want to be able to rotate and move the camera? Do you want to move/rotate the object? Do you want surfaces or just wireframe?
__________________
/Niklas Jansson |
|
|
|
|
|
#6 |
|
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
That sounded weird. If you want to make 3D-objects yourself you could use any program, VB, some C++ compiler or even Excel.
If you really need these 3D-objects to be perfect you should consider a program designed for 3D, Like 3DsMAX or Bryce (?) or some CAD-program (I know AutoCAD has 3D-possibilties). If you want to make it in excel (which is a rather funny idea, and I'd really like to see the result if you're going to do it), you'll need some mathematical transformations from 3D-space to 2D. You also need to make a number of decisions regarding how complex it should be. For a standard wireframe method there shouldn't be any particularly hard task, but just the step from wireframe to "Hidden line removal" (you only see the part of the lines actually visible) is a rather big. It could actually be easier with a surface rendering.
__________________
/Niklas Jansson |
|
|
|
|
|
#7 |
|
Join Date: May 2002
Posts: 18
|
Hey Vas,
Okay. I dont have access to AutoCad right now. I do have access to a program called MathCAD. In this program, I can create 3D surfaces based on equations--but I can't figure out how to create a shape based on its vertices. I just want a basic 3D shape that verifies that my vertice values are correct. I don't need to rotate the camera or the shape although MathCAD has these abilities. And wireframe would be fine. Thanks for your help, Serious |
|
|
|
|
|
#8 |
|
Join Date: May 2002
Location: Phoenix, AZ, USA
Posts: 29
|
This might be a dirty way to get an idea of what your data looks like. Try doing three scatter plots with (x,y), (x,z), and (y,z) as your data sets. you will get three "views" of your data. I know this is completely non-elegant, but it also requires almost no work.
|
|
|
|
|
|
#9 |
|
Join Date: May 2002
Posts: 18
|
Hey PH,
Thanks for the suggestion. I tried that and it does a decent job of portraying the shape. I still want to try the 3D approach so that other users can get a good picture of what the shape will look like right away from one graph but now I do have something to fall back on in case the 3D approach is too difficult. Thanks Serious |
|
|
|
|
|
#10 |
|
Join Date: May 2002
Location: Gothenburg, Sweden
Posts: 74
|
Ok, good. Then there should be no problem.
First: if the object is centered around (0,0,0) you need a camera (and it's a good idea anyway). Code:
Public Type Point3D
X As Double
Y As Double
Z As Double
End Type
Private CameraPoint As Point3D
To convert the "World" point to Camera point we'll need a Function for that. (Very easy - no rotations!) Code:
Public Function WorldToCamera (Point As Point3D) As Point3D
With WorldToCamera
.X = Point.X - CameraPoint.X
.Y = Point.Y - CameraPoint.Y
.Z = Point.Z - CameraPoint.Z
End With
End Function
Code:
Public Type Point2D
X As Double
Y As Double
End Type
Const D As Double=1 'Tweak this if you want to change perspective
Public Function CameraToScreen(Point as Point3D) As Point2D
With CameraToScreen
If Point.Z = 0 Then 'The point is exactly in your eyes
.X = -10000
.Y = -10000
Else
.X = d * Point.X / Point.Z
.Y = d * Point.Y / Point.Z
End If
End With
End Function
If you need further help, reply again.
__________________
/Niklas Jansson |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|