Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7674207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:41:16+00:00 2026-05-31T16:41:16+00:00

I have to implement simple ray tracing algorithm, but I can not figure out

  • 0

I have to implement simple ray tracing algorithm, but I can not figure out How can I get Normal Vector of the sphere If I have the origin and radius of the sphere and the direction of the ray.
thanks
Wiki aboute sphere but i can not figure it out of this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:41:17+00:00Added an answer on May 31, 2026 at 4:41 pm

    I have find the solution: here is the code in C#:

    Double alpha = Math.Asin(sphere.Radius / (Math.Sqrt(Math.Pow(sphere.Origin.X-ray.Origin.X,2)+Math.Pow(sphere.Origin.Y-ray.Origin.Y,2)+Math.Pow(sphere.Origin.Z-ray.Origin.Z,2))));
    Double beta = Math.Acos((ray.Direction * (sphere.Origin - ray.Origin)) / (ray.Direction.Length * (sphere.Origin - ray.Origin).Length));
    
    ray.HitParam = VypA(sphere.Origin - ray.Origin, beta, sphere.Radius) / ray.Direction.Length;
    Vector4 g = ray.Origin + ray.Direction * ray.HitParam;
    ray.HitNormal = (g - sphere.Origin).Normalized;
    
    ////the VypA function
    
        public static Double VypA(Vector4 b, Double beta, Double radius)
                {
                    return b.Length * (Math.Cos(beta) - Math.Sqrt(((radius * radius) / (b.Length2) - (Math.Sin(beta) * (Math.Sin(beta))))));
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implement the simple TCP server and TCP client classes which can send
I am trying to implement a simple decimation algorithm in c++. I have two
I have to implement a simple hashing algorithm. Input data: Value (16-bit integer). Key
I have to implement a simple (not clustered) timer for WebLogic and it seems
i have this class called MemoryManager, it is supposed to implement a simple smart
In general, is it a best practice to have simple POJO Java classes implement
I am working on a college project, where I have to implement a simple
In My Application i have Implement the Simple Gallery Demo. Here i am going
I have a Django application in which I need to implement a simple trending/ranking
I'm trying to implement a simple search function. I have a string array which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.