Findning the normal vector to a sphere's surface

Click For Summary

Discussion Overview

The discussion revolves around computing the normal vector to a sphere's surface at a given point, considering an orthographic projection. Participants explore the mathematical and programming aspects of deriving this normal vector, including the use of angles and trigonometric functions.

Discussion Character

  • Homework-related
  • Mathematical reasoning
  • Technical explanation

Main Points Raised

  • The initial post outlines an attempt to compute the normal vector using trigonometric functions and vector calculations, but the author expresses uncertainty about the correctness of their approach.
  • One participant points out a potential issue with the use of degrees instead of radians in trigonometric calculations, specifically in the tangent vector components.
  • The original poster acknowledges difficulties in understanding the physics involved and requests clarification on using angles and vectors in the context of the problem.
  • Another participant expresses confusion regarding the definitions and values of the angles θ, φ, and ρ, which are critical for the calculations.

Areas of Agreement / Disagreement

Participants express varying levels of understanding and confusion regarding the calculations and concepts involved. There is no consensus on the correct approach or solution to the problem.

Contextual Notes

There are unresolved questions about the definitions of angles and their application in the calculations. The discussion highlights potential misunderstandings regarding the use of trigonometric functions in programming.

Who May Find This Useful

This discussion may be useful for students or individuals working on problems related to vector mathematics, spherical geometry, or computer graphics, particularly in the context of projecting 3D shapes onto 2D planes.

dadin22
Messages
4
Reaction score
0

Homework Statement



Assuming an orthographic projection, the sphere projects into a circle on the image plane.
compute the normal vector to the sphere’s surface at a given point(x,y). The Sphere's center coordinates x,y are known as well as the radius. The resulting normal is in 3d coordinate system. the origin of vector is in sphere's center. its x-axis and y-axis parallel to the image's x-axis and y-axis. z-axis should be as such to form a orthonormal right-hand coordinate system.

Homework Equations



Our surface is a Lambertian surface.

The Attempt at a Solution



double phi=atan(yp/xp);
count<<phi;
count<<" "<<xp<<" "<<yp;//
double zp=90*cos(phi);

double z = sqrt((r*r)-(x*x)-(y*y));

// (xp-x)^2 + (yp-y)^2 + (zp-z)^2 = R



/* tangent vector with respect to image plane */
double tx = -sin(phi);
double ty = cos(phi);
double tz = 0;

/* tangent vector with respect to sphere */
double sx = cos(phi)*(-sin(90));
double sy = sin(phi)*(-sin(90));
double sz = cos(90);

/* normal is cross-product of tangents */
double nx = ty*sz - tz*sy;
double ny = tz*sx - tx*sz;
double nz = tx*sy - ty*sx;

/* normalize normal */
double length = sqrt(nx*nx + ny*ny + nz*nz);
nx /= length;
ny /= length;
nz /= length;

count<<brightest_Pixel;
count<<" "<<length;
 
Physics news on Phys.org
Are you having problems with this? You didn't say.

One thing that jumps out at me are your calculations for the tangent vector components tx, ty, and tz.
Code:
double sx = cos(phi)*(-sin(90));
double sy = sin(phi)*(-sin(90));
double sz = cos(90);
The trig functions in math.h take arguments in radians, not degrees. The sin(90) and cos(90) expressions make me think you're not aware of that.
 
Thanks for your reply mark,

I do having problems with it. I can't figure our the way to compute the normal vector.

I know I need to use theta angle and u and v vectors. I also can use the radius and the sphere's center. However I really not so good with the physics part of the problem.

I completely not sure about the code i wrote and if it even makes sense. Thanks for your observation regarding use of radians with math.h

can you maybe give me an head start for the problem or explain it in a clearer way?
 
I am not sure what are the values of my θ, φ and ρ where

ρ - distance from the origin.
φ - the angle from the z-axis
θ - is the angle from the x-axis
 
help ??
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
2K
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K