Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlotGrapher- V205 #226

Merged
merged 27 commits into from
Jan 10, 2024
Merged

BlotGrapher- V205 #226

merged 27 commits into from
Jan 10, 2024

Conversation

V205Arduino
Copy link
Contributor

@V205Arduino V205Arduino commented Dec 25, 2023

Hi! This is my blot program.

This was a collaboration between me and @BrightTheBackpack

BlotGraph ( or BlotGrapher) can currently plot lines (probably can’t draw an equation with two y values for every x yet.) and crop them.

To draw lines, create a function for a formula in the format y = ???
Example:
var quadratic = function(n) { return (1 / 4 * n * n - 2 * n+ 4) } //v+Math.sqrt(r-Math.pow(n-v,2)))

Draw it in a draw turtle with the drawEquation command:
`drawTurtles([
drawEquation(quadratic, 1, 100, 20),

]);
`
The drawEquation function has these parameters:

drawEquation(formula, resolution, maxX, minX, maxY, minY)

All the parameters can be left blank except for the formula one

Old way(don’t use):

You can play around with resolution, maxX, minX, maxY, and minY.

The function used to draw lines is:
drawEquation(formula, resolution, maxX, minX, maxY, minY)
The formula will be something like this:

var quadratic = function(n) {
  return (1 / 4 * n * n - 2 * n+ 4)
} //v+Math.sqrt(r-Math.pow(n-v,2)))

And the rest of the parameters are non zero integers.
Resolution could be negative, but currently, I have blocked that.

Here is an example call of the drawEquation function.

// a quadratic.
drawEquation(quadratic, 0.1, 100, -100, 100, 0)

Or, if you don’t want to use all the parameters (only formula is required), it will just use default values.

// a quadratic.
drawEquation(quadratic)

There is more info in the code.

A display of all of BlotGrapher’s current features:
From left to right: A linear line, A sine wave, a quadratic, and another sine wave (but it is cropped).
image

Default program:

var linearLine = function(n) {
  return (2 * n + 2) //Math.sin(n) +
} //v+Math.sqrt(r-Math.pow(n-v,2)))
drawEquation(linearLine);

//draws a sine wave
// y = a * sin(n+ b) or something like that, I can't remeber
// y = sin(n) + 9
var sineWave = function(n) {
  return (Math.sin(n) + 9) //Math.sin(n) +
} //v+Math.sqrt(r-Math.pow(n-v,2)))
drawEquation(sineWave);

// another sine wave, but modified slightly.
// y = sin(n) + 21
var sineWave2 = function(n) {
  // similar to sineWave1, but adds 12.
  // it looks very different because of the additional parameters called(see below).
  return sineWave(n) + 12; // lazy way :) 

}
// here is a test of the maxX, minX, maxY, and minY parameters.
// the left, right, top and bottom are cut off.
drawEquation(sineWave2, 0.1, 39, 20, 21, 20.4)

// a quadratic equation
// y = ax^2 + bx + c
var quadratic = function(n) {
  return (1 / 4 * n * n - 2 * n - 2)
} //v+Math.sqrt(r-Math.pow(n-v,2)))

// a quadratic.
drawEquation(quadratic, 0.1, 100, 0, 18, 0)

Quadratic:

image

var quadratic = function(n) {
  return (1 / 4 * n * n - 2 * n+ 4)
} //v+Math.sqrt(r-Math.pow(n-v,2)))

// a quadratic.
drawEquation(quadratic, 0.1, 100, -100, 100, 0)

SineWave:
image

var sineWave = function(n) {
  return (Math.sin(n)+ 10)
} //v+Math.sqrt(r-Math.pow(n-v,2)))

// a sine wave.
drawEquation(sineWave, 0.1, 30, 10, 100, -100)

I’ll probably add more things later.

Is that enough?

Thank you.
I probably made a mistake in my formatting……
IMG_1147

That image is completely drawn by BlotGrapher,
Most of the lines are quadratics in the form y = ?(x - ?)^2 + ?

(edit, adding photo)

Copy link

vercel bot commented Dec 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blot-3dgallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2024 11:59pm

Copy link

vercel bot commented Dec 25, 2023

@V205Arduino is attempting to deploy a commit to the Hack Club Team on Vercel.

A member of the Team first needs to authorize it.

@leomcelroy
Copy link
Contributor

Thanks so much for the submission. I love this graphing functionality! Do you think you could use it to make something artistic as well? I think this idea applied to creating a nice visual piece will certainly earn a Blot.

@leomcelroy leomcelroy closed this Jan 2, 2024
@V205Arduino
Copy link
Contributor Author

Ok! I have created a visual piece

I will update the program now.

@V205Arduino
Copy link
Contributor Author

I don't think I can reopen this?

@V205Arduino
Copy link
Contributor Author

Screenshot 2024-01-05 at 9 20 07 PM

@leomcelroy
Copy link
Contributor

I think you're file is a little messed up. It's related to the {...} you have around comments. Could you clean that up so it runs properly? Also please center the PI in the drawing window.

@V205Arduino
Copy link
Contributor Author

Ok, thank you,
I added the {…} to be able to collapse the code, seems like it does not work, fixing

@V205Arduino
Copy link
Contributor Author

V205Arduino commented Jan 7, 2024

Is this eligible for a Blot or should I start over?
Thank you

@V205Arduino
Copy link
Contributor Author

Have updated OP and code

@leomcelroy leomcelroy merged commit 0b03b22 into hackclub:main Jan 10, 2024
2 of 3 checks passed
@leomcelroy
Copy link
Contributor

Nice! Here is your Blot order form. Well earned.

@V205Arduino
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants