More like release week!

I was a little presumptuous on my last post, thinking that the due date for this first release was on Monday.  I didn’t see the “week of” part on the due date.  Well that means I’m somewhat ahead of the curve.  I’ve got my working object in javascript and I’ve got the link to the actual object now that I’ve got my matrix account up and running again.  If you want to take a look at PVector in just in it’s entirety, click here.  Now that’s the semi-tested, though working, and uncommented version.  I’ll finish it soon as I finish testing, which I’ll be working on today.  It’s also the version that hasn’t been changed to stop using the “this operator” as suggested by Dave.

I can see the cause for concern with the operator… it doesn’t work the same way as I’m used to with Java and C# Object Oriented Programming.  However, there are instances where I am having trouble thinking of a way of taking them out.  Particularly, the instances when a method is referencing the main object.  Like in this particular method:

PVector.prototype.mag = function(){

	return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);


If I keep it to just (x*x + y*y + z*z),  I don’t think it’ll take the attributes of the prototyped object.  I’m not completely sure, as more extensive tests need to be done.  However I will for sure be taking out the “this” keyword in this sample code:

PVector.prototype.get = function(){

	return this;


I wasn’t sure that would work to begin with.  I have yet to see an example to show me that it does work.  So, that will be changed for sure.  Anyway, back to testing for me.  If I can get this working properly soon and all the tests pass, I’ll be looking to make a demo with hopefully some vector math (such as acceleration and velocity).  I’ve still got some work to do before then though.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: