Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 627 posts ]  Go to page Previous  1 ... 57, 58, 59, 60, 61, 62, 63  Next
Author Message
 Post Posted: September 22nd, 2017, 11:06 am 
User avatar

Joined: December 15th, 2012, 2:18 pm
Posts: 18
I didn't remember to look in the chillipedia. Nevertheless, I found it there: http://wiki.planetchili.net/index.php?t ... l_6#Errata

I just thought you might be interested in :)


Top 
 Profile  
Reply with quote  
 Post Posted: September 22nd, 2017, 11:28 am 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
Yeah for sure. Never considered it since "why would anyone do that?"

Added this

if (pPixels != rhs.pPixels)

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: September 22nd, 2017, 11:46 am 
User avatar

Joined: December 15th, 2012, 2:18 pm
Posts: 18
Yumtard wrote:
Yeah for sure. Never considered it since "why would anyone do that?"

Added this

if (pPixels != rhs.pPixels)


I wouldn't suggest doing that. Suppose, you have several different dynamic arrays in your class. In your assignment operator you would have to check all the pointers eg.:

Code:
if( arr1 != rhs.arr1 && arr2 != rhs.arr2 && arr3 != rhs.arr3 ... )

you get the idea

Simple
Code:
 if(this != &rhs)
should suffice, I think :)


Top 
 Profile  
Reply with quote  
 Post Posted: September 22nd, 2017, 12:52 pm 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
Yeah, either would work, but better to check pointer to whole object than pointer to content I think. More idiomatic.

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: September 22nd, 2017, 12:58 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
solid point

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: September 28th, 2017, 4:23 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
Got a good grade on the pokemon simulator. Teacher had a bunch of feedback on things I could've done better tho.

For math assignment we got a framework with a bunch of declared functions we had to implement.

In the vector class we had
Distance()
Add()
Subtract()
DotProduct()
CrossProduct()

Matrix class:
Multiply()
RotateAroundX()
RotateAroundY()
RotateAroundZ()
RotateArouncXYZ()

and finally in the plane class:
bool IntersectsWithLine()

I finished these with a bunch of time to spare so I've added
in vector:
length()
lengthsq()
Normalize()

in Plane:
IntersectionPoint()

in Matrix
Identity()
bool Orthogonal()
bool Orthonormal()
bool Involutory()
Inverse()
Transpose()
Determinant()
Scale()

Overloaded a bunch of operators too to make life easier and make it possible to multiply a matrix with a vector.

Might be forgetting some functions. Not sure what else to add. Wanna be able to do translation but for that I need a 4x4 matrix. The matrix class we got to work with is a 3x3 matrix which has 3 vectors representing its rows.

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: September 28th, 2017, 7:25 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2782
Location: Oklahoma, United States
Only need a 4x4 if you are doing 3D transformations, which I guess you are. A 3x2 matrix is all that is needed for 2D transformations, so you could still use it especially with your orthogonal view matrix.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: September 29th, 2017, 7:47 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
Yeah we're doing 3D

I guess I could add a vector maybe..
Anyways I'm working on something else now. Trying to make a function that returns the line where 2 planes intersect. I know how to do it mathematically but having some trouble translating it into code.

Atm I'm always setting x to 0. This makes the function work, but not for all cases.. Will try to figure something out.

Found this on stackoverflow.


Image

he adds these 2 equations and get this result:

Image

could someone help me understand how he manages to get z by itself on the left hand side?
When I try adding these I get stuck with the left side being
(-B2/B1)*C1z + C2z
And I can't figure out a way to get this thing down to just z

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: September 29th, 2017, 8:49 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
nvm his answer was incorrect

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: September 29th, 2017, 10:49 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 487
Location: Idiot from northern Europe
Image

yay. Think I should be able to fix my function now

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 627 posts ]  Go to page Previous  1 ... 57, 58, 59, 60, 61, 62, 63  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: