Solved

Need clarification for computing  normal of a sphere

Posted on 2008-11-01
8
1,178 Views
Last Modified: 2013-12-26
I am trying to compute the 3D surface normal for a given point on a sphere, in order to find the direction of a light source. I am given the sphere's orthographic projection on the image plane, which is basically a circle, and I have found the center, radius, and area of this circle.

Given that the equation of a sphere is (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = r^2, where xc,yc, and zc are the coordinates of the centroid of the sphere. I have solved for (z-zc) using this equation. I just want to make sure: if I compute the gradient (2(x-xc), 2(y-yc), 2(z-zc)), it safe to assume that the sphere's gradient will give me the normal vector TO the sphere's surface at the point (x,yz)? (the normal originates at the sphere's center)
0
Comment
Question by:sph2105
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 22860805
I've read this question a few times and am not sure what you're asking. But why are you working in Cartesian coordinates anyway? This problem has spherical symmetry you should consider working with spherical coordinates.

Brian
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 22860822
>>(x-xc)^2 + (y-yc)^2 + (z-zc)^2
>>Gradient  (2(x-xc), 2(y-yc), 2(z-zc))

That's not correct.

If your function is f(x,y,z) = (x-xc)^2 + (y-yc)^2 + (z-zc)^2

Then you have:

f(x,y,z) = (x(1-c))^2 + (y(1-c))^2 + (z(1-c))^2
grad f(x,y,z) = (1-c)^2 * (x^2 + y^2 + z^2)
                    = (1-c)^2 + (2x a_x + 2y a_y + 2z a_z)

Another way to look at it:

f(x,y,z) = (x(1-c))^2 + (y(1-c))^2 + (z(1-c))^2

grad f = 2(x(1-c)) * (1 - c) a_x + 2(y(1-c)) * (1 - c) a_y + 2(z(1-c)) * (1-c) a_z

           = (1-c)^2 +(2x a_x + 2y a_y + 2z a_z)


Brian

0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 22861288
BrianGEFF719>> xc is NOT x*c, but x(center) etc  so his formula for the coordinates of the surface of the sphere, in Cartesian coordinates (x,y,z) is correct.  The comment about using Spherical coordinates is also the proper way to approach this problem.

AW
0
 

Author Comment

by:sph2105
ID: 22861358
Sorry for being unclear, as I typed this question in a rush. Let me try to clarify:

xc, yc, and zc are indeed x(center), y(center), and z(center). as suggested by Arthur.

The reason I want to stick with Cartesian coordinates is because I am working with an image which I will have to process later, so rather than switching back and forth between Cartesian and polar, I would rather just stay in Cartesian.

What I am basically asking is: does using the gradient formula I stated give me the normal from originating from the center of the sphere to the point (x,y,z) ?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:sph2105
ID: 22861460
wow, let mer retype that, since I cant edit posts

does that gradient  2*(x-xc), 2*(y-yc) 2*(z-zc) give the normal originating at the center of the sphere to point (x,y,z)?
0
 
LVL 27

Accepted Solution

by:
aburr earned 500 total points
ID: 22861717
yes
grad f, evaluated at a point P: (x1, y1, z1  is normal the the surface f(x, y, z) = c at P,
0
 
LVL 27

Expert Comment

by:aburr
ID: 22861769
you can also calculte the equation of a line from the center to (and through) your point from
(x-x1)/(x1-x2) = (y-y1)/y1-y2)=(z-z1)/(z1-z2)
where x1,y1,z1 and x2,y2,z2 are two points (center and surface points)
0
 

Author Comment

by:sph2105
ID: 22861792
Thanks aburr.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

A Guide to the PMT, FV, IPMT and PPMT Functions In MS Excel we have the PMT, FV, IPMT and PPMT functions, which do a fantastic job for interest rate calculations.  But what if you don't have Excel ? This article is for programmers looking to re…
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now