Raised This Month: $ Target: $400
 0% 

rotating 1D array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-15-2014 , 11:40   rotating 1D array
Reply With Quote #1

Hello everyone!

So i have a array here:
{ 0, 1, 2, 3, 4, 5, 6 }
it is 0 degrees

180 degrees and the vector would be:
{ 6, 5, 4, 3, 2, 1, 0 }

90 degrees:
{ 1, 5, 3, 0, 4, 6, 2 }

270 degrees:
{ 2, 6, 4, 0, 3, 5, 1 }

the question is:
what numbers there will be inside the array if the angle is 45 or 76 etc... degrees?
Is there anyway to calculate it?

Thanks!

Last edited by .Dare Devil.; 12-15-2014 at 11:59. Reason: vector doesn't make sense or does it?
.Dare Devil. is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-15-2014 , 12:48   Re: rotating 1D array
Reply With Quote #2

Rotating by degrees implies a 2D plane rather than a 1D set of values.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-15-2014 , 13:34   Re: rotating 1D array
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
Rotating by degrees implies a 2D plane rather than a 1D set of values.
Perhaps i should explain what i want to do.
Well, inside the array the are vertex indices.

I have mesh what have already 2 indices arrays inside of it.
one is sorted near >= far in x axis and the other one is sorted near >= far by y axis.

I'm not sure if you guys know that but in order to draw complex transparent mesh the triangles needs to be sorted, other ways you will see weird results.

we already know what we have in indices array when angle is 90,270, 0, 180 but now i need a formula what predicts the order when angle is something what i haven't listed.
Somehow i feel it can be done but im not quite sure.

It is really annoying and cpu waste if i need to sort vertices by their distances each time the angle changes.

1. checking float/double is much more slower than checking ints ( not sure why )
2. you will have 3 variables to deal instead of one linear array what i wish.
3. in order to calculate distance in 3d i must use square root but calculation square root is also taking much cpu power.

When i say much cpu power then i meant something like:
1-5000 times per frame is okay but 100 000 - 1 000 000 is just omg


It is rare case if i have more than 100 000 transparent triangles but hey, who knows what i wish to do
with my engine and i also wish that it would work as fast as possible.
.Dare Devil. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode