Solved

Need clarification for computing  normal of a sphere

Posted on 2008-11-01
8
1,187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
ClickHouse in a General Analytical Workload

We have mentioned ClickHouse in some recent posts, where it showed excellent results.

In this article on Experts Exchange, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.

 

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
 

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

MongoDB Through a MySQL Lens

This article looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

623 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