bmoren / p5.collide2D

A collision detection library for 2D geometry in p5.js
Other
582 stars 296 forks source link

move documentation to the wiki feature or seperate page? #35

Open bmoren opened 4 years ago

bmoren commented 4 years ago

is this a good idea? maybe a series of md files, or a gh-pages documentation instead?

I think this would clear up the read-me a bit and allow for some more in-depth examples.

wisehackermonkey commented 4 years ago

Thought

Modify the main readme for getting started, with a simple example

and have a list of functions signatures to choose from

where the user clicks on each to see more in-depth examples.

Docs options that would be cool, in addition to github page

Moving forward

If we move the examples to md files i think it might be worth it to start using doc generation
like add all the examples in a comment above the function definition

Benifits

1) keep the docs close to the function within the code and makes for easy search and replace
2) doc generators automatically generate lists of functions with links to examples out of the box

Example

Examples of great documentation from other github projects for inspiration

//###########collidePointCircle###########
// #### collidePointCircle()
// ###### collidePointCircle(pointX, pointY, circleX, circleY, diameter)
// point to circle collision in 2D. Assumes ellipseMode(CENTER);

// var hit = false;
// function setup() {
//  ......
// }
// function draw() {
//  ......
//  hit = collidePointCircle(mouseX,mouseY,200,200,100)
// ......
// }
//--------------------
p5.prototype.collidePointCircle = function (x, y, cx, cy, d) {
//2d
if( this.dist(x,y,cx,cy) <= d/2 ){
  return true;
}
return false;
};