POV-Ray : Newsgroups : povray.programming : Raw_Normal Server Time20 Jul 2024 04:54:32 EDT (-0400)
 Raw_Normal (Message 1 to 3 of 3)
 From: 225012156 Subject: Raw_Normal Date: 23 Jun 2023 22:50:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.6496590bf1906642aec747c4fc1cf70c%40news.povray.org",
"dateCreated": "2023-06-24T02:50:00+00:00",
"datePublished": "2023-06-24T02:50:00+00:00",
"author": {
"@type": "Person",
"name": "225012156"
}
}
What exactly is the definition of Raw_Normal? I always thought it was a normal
vector on the surface where the light intersects with Object, but I tried to
construct a little triangular element
#declare fugai_48 = mesh2 {
vertex_vectors {
3
<-4.50633802, 3.69271012, -10.9775885>,
<-4.65835461, 3.42382252, -11.3457332>,
<-4.93662437, 3.47962036, -10.95792829>,
}
face_indices {
1
The < 0 >,
}
}
Its Raw_Normal is [-0.41867095 0.80698168-0.41652757]
But I wrote a function in python that computes the normal vector of a surface
def calculate_normalized_normal(v1, v2, v3):
# Compute two side vectors
edge1 = v2 - v1
edge2 = v3 - v1

# Calculate normal vector (cross product)
normal = np.cross(edge1, edge2)

# Normalized normal vector
normal_normalized = normal / np.linalg.norm(normal)

return normal_normalized
The output is [-0.41867126 0.80698158-0.41652743]
This is really confusing to me
```
 From: jr Subject: Re: Raw_Normal Date: 24 Jun 2023 01:55:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.649684c26e9a403cb49d80446cde94f1%40news.povray.org",
"dateCreated": "2023-06-24T05:55:00+00:00",
"datePublished": "2023-06-24T05:55:00+00:00",
"author": {
"@type": "Person",
"name": "jr"
}
}
hi,

"225012156" <225### [at] csueducn> wrote:
> What exactly is the definition of Raw_Normal? ... tried to
> construct a little triangular element ...
> # Calculate normal vector (cross product)
> normal = np.cross(edge1, edge2)
>
> # Normalized normal vector
> normal_normalized = normal / np.linalg.norm(normal)
>
> return normal_normalized
> The output is [-0.41867126 0.80698158-0.41652743]
> This is really confusing to me

hoping that my lack of maths won't betray me :-) but aren't you comparing
"apples and oranges" ?  the face normal of a triangle is not the same as a
'vcross' product.  (see first link for 'vcross' definition, second link is a C
program source where face normals get calculated (as an option).  hth)

<https://wiki.povray.org/content/Reference:Vector_Expressions#Functions>

regards, jr.
```
 From: Bald Eagle Subject: Re: Raw_Normal Date: 24 Jun 2023 11:45:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.64970f0d6e9a403c1f9dae3025979125%40news.povray.org",
"dateCreated": "2023-06-24T15:45:00+00:00",
"datePublished": "2023-06-24T15:45:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"225012156" <225### [at] csueducn> wrote:

It looks like you're doing everything properly to me.
There may be some issues with the original vertex values, rounding, etc that
make the numbers you are getting slightly different when doing it POV-Ray vs
another computer language.

I know that under the hood certain numbers are represented as doubles rather
than longs, etc.

But you're doing it the right way.  It's certainly the way I learned how to do
it.

https://www.scratchapixel.com/lessons/geometry/bezier-curve-rendering-utah-teapot/bezier-patch-normal.html

- BE
```