|
-
May 25th, 2007, 09:51 PM
#1
[RESOLVED] 2D loop to plot surface of a 3D sphere?
Yes, I realize that a sphere is nothing BUT 3D... but I figured I'd toss it in there just to clarify my intents. I have two loops going, both from 0 to 359. The outer loop is defining the angle of the next circle along the X-Z plane, and the inner loop draws the circle along the Y-angle of outer loop plane. I can get the inner loop to draw just fine.. I know the Y variable is the independent variable in this situation. I know the X and Z variables need to play off of each other to figure out where the point actually is, but I'm not sure how... yes it's a program, but it's the math that hurts. Here's my loop right now:
Code:
For i As Integer = 0 To 359 Step 5
For j As Integer = 0 To 359 Step 5
Points.Add(New Pt3D(size * Sin(j / rad), size * Cos(j / rad), size * Cos(i / rad), Pens.White))
Next
Next
in this instance, rad is defined as 180/PI... a conversion factor so my angles get changed to radians before the trig functions hit them... bloody program only knows radians...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|