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

  • SEARCH
  • Home
  • 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 873455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:56:19+00:00 2026-05-15T10:56:19+00:00

I am making a piece of code for DirectX app. It’s meaning is to

  • 0

I am making a piece of code for DirectX app. It’s meaning is to not show faces that are not visible. Normaly it would be just using Z-buffer, but I’m making many moves and rotations of mesh, so I would like to not do them and save computing power. I will describe this on cube. You are looking from the front so you see just one face and you don’t need to rotate the 5 that left. If you would have one side of cube from 100*100 meshes, it would be great to not have to turn around 50k meshes that you really don’t need. So I have stored X,Y,Z rotation of camera(the Z rotation I’m not using), and also X,Y,Z rotation of faces. In this cube simplified I would see faces that makes this statement true:

cRot //camera rotation in degrees

oRot //face rotation in degrees

if(oRot.x > cRot.x-90 && oRot.x < cRot.x+90
    && oRot.y > cRot.y-90 && oRot.y < cRot.y+90)

But there comes a problem. If I will rotate arround, the camera can get to value 330 for exapmple. In this state, I would see front and right side of cube. Right side have rotation 270 so that’s allright in IF statement. Problem is with 0 rotation of front face, which is also 360 degrees.

So my question is how to make this statement to work, because when I use modulo, it will be failing for that right side and in this way it won’t work for 0=360.

  • 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-15T10:56:19+00:00Added an answer on May 15, 2026 at 10:56 am

    You mean to check if oRot differs from cRot at least by 90 degree?

    //integral
    if ((360 + cRot - oRot) % 360 >= 90) ...

    //floating point
    diff = abs(cRot - oRot);
    if (diff >= 90 && diff <= 270) ...

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a WinForms app with a ListView set to detail so that several
I have a long piece of code that calculates two values ( doubles )
I have a small piece of code that depends on many static libraries (a_1-a_n).
I'm going through some old C#.NET code in an ASP.NET application making sure that
I have a piece of code that 'updates' an entry in the database by
I have a piece of code that looks like this: downloadsByExtensionCount = defaultdict(int) downloadsByExtensionList
I've noticed that viewDidLoad of the viewController will not run if the app has
After making a few modifications to a rails app I am tinkering on, railroad
I have the following piece of code, which I want to make parallel in
I have a piece of code which deals with customers stored in database. There

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.