Smilebags / p5.dimensions.js

An addon for p5.js which adds support for higher dimensional calculations.
72 stars 24 forks source link

nObject class and functions for it. #22

Open Smilebags opened 7 years ago

Smilebags commented 7 years ago

This is a place to track proposals and progress on the nObject class and related functions. I'm working on an initial constructor function to lay out the basics of how it will all work.

I'm thinking of moving to typescript for this to allow for easier development.

Smilebags commented 7 years ago

@max0410 are you familiar with TypeScript and able to work with it? If so I might work on re-organizing the code as TS files then bring them together compile-time.

max0410 commented 7 years ago

Yes, I am familiar with typescript. I might be a bit rusty though. But, isn't just javascript with classes and some other fancy functions? I wouldn't mind if you did it in typescript.

max0410 commented 7 years ago

I added nShift #23

Smilebags commented 7 years ago

Thanks for the PR.

Typescript (as you probably know) allows strong typing. It means we can define data structures for things like the nObject, which can then be error-checked and viewed anywhere in the code. It helps things to be more readable and scalable, and means we can easily split the library into more manageable chunks. If you have a suitable environment for working in TS, I'll convert the project.

max0410 commented 7 years ago

Yes, i have an environment.

I recently got @shiffman 's attention on a live stream about p5js dimensions, and he said he would gladly do it if I either tweet or sent a github issue on his channel repo with more info. I know you'll probably say yes, but I just want to get your approval.

Smilebags commented 7 years ago

Great.

For him to convert it to TS? Or to publicise it? Thanks for asking but you don't need my permission to do stuff like that! Go ahead! This is our repo, you've done half the work, so feel free to do anything you like.

Smilebags commented 7 years ago

image ^^

max0410 commented 7 years ago

No, no, no! He would just make a video about it! He wouldn't be making a cool project out of it, not contributing.

max0410 commented 7 years ago

I guess I just though you'd like to know.

Smilebags commented 7 years ago

Yeah, that sounds good! Thanks for letting me know. Maybe I'll create a new branch for TS conversion (and we will work on the nObject in there?) so that the library isn't constantly changing, potentially with bugs to anyone trying to use it.

max0410 commented 7 years ago

Ok!

Smilebags commented 7 years ago

I have had a look at converting to TS and it is more messy than I thought. I mean all you have to do is rename the file, but to get it to work nicely and not show lots of errors is a bit harder. Are you familiar with how to say that the project is dependent on p5 in TS?

Smilebags commented 7 years ago

I have a feeling some sort of import should work but I just don't know how to get it to work.

max0410 commented 7 years ago

To tell the truth I don't know much about TS. I'll research it.

Smilebags commented 7 years ago

Me too! high-5 I know it is worth using for larger projects but I've only really dabbled in the basics of it.

max0410 commented 7 years ago

Do you really get any errors just by renaming the file? Probably some warnings, but I don''t see why there would be errors.

max0410 commented 7 years ago

Also I sent him a tweet: @shiffman Here is something for a coding train video! Try out p5 dimensions! http://github.com/Smilebags/p5.dimensions.js

Hopefully he responds soon!

Smilebags commented 7 years ago

TypeScript Errors are more picky than JavaScript ones. For example every p5.prototype.something line gives an error saying "Cannot find name 'p5'."

Smilebags commented 7 years ago

It still compiles, if you allow it to, but it isn't clean TypeScript.

Smilebags commented 7 years ago

Thanks! I look forward to his reply.

max0410 commented 7 years ago

Ah

max0410 commented 7 years ago

About, the nD viewer idea. Here is a site about 4d visualizations: http://www.math.union.edu/~dpvc/math/4d/models/welcome.html

Smilebags commented 7 years ago

This is the same idea I had, pretty much. But I want to make it easy to interact with. It would be perfect if rotating the object in nD and moving/controlling the camera in nD was simple. Also the 'slice' view they show, I've been trying to work out how to do it. Doesn't seem easy. Cool link, thanks!

max0410 commented 7 years ago

I'll look in to their code.

max0410 commented 7 years ago

I got a response from @shiffman! He told me to make an issue in his channel repo.

max0410 commented 7 years ago

Though I need to give him some topic or challenge around our library, any suggestions?

Smilebags commented 7 years ago

Great! Hmm it is hard... Once the object functions are added it would be easier to think of a challenge. I can probably write a 4d to 3d projection function pretty easily but nothing regarding drawing vertices, edges and faces... Should we tell him to wait off till that's done or can you think of an idea which can use the library in it's current state?

max0410 commented 7 years ago

I don't think it would be problem if we held off on it for a bit, he does already have a lot of suggestions.

Smilebags commented 7 years ago

Yeah lets get things a bit more polished off first.

shiffman commented 7 years ago

Yes, no hurry, I've got a big backlog of this to do! A challenge idea (keeping it as simple as possible) would be great!

max0410 commented 7 years ago

Ok, no problem @shiffman!

Smilebags commented 7 years ago

Well that was difficult, but I managed to set down a good base in order to work out the other stuff we will need more easily in this commit 00016d5d5649d9615ba58867a48692f57f909cd5

Smilebags commented 7 years ago

@max0410

max0410 commented 7 years ago

Good job! So now we have it all configured to typescript now?

max0410 commented 7 years ago

Oh, nevermind that ^, I looked at the wrong edit.

Smilebags commented 7 years ago

Yeah, everything is working in TS, and compiles down to a compatible version of the JS library. Should we release 1.1?

max0410 commented 7 years ago

Oh, nice! I guess, you could release 1.1. But I wouldn't really concern myself with version numbers.

Smilebags commented 7 years ago

I just think it is a good way to track changes and to make sure anyone using it can be sure what versions can be used without changing their code. I'll merge the branch and release 1.1