Skip to content

Conversation

@nicolau-manubens
Copy link

Some draft code for drawing string arts with a displaced center.

@dvuckovic
Copy link
Owner

Hi @nicolau-manubens, thanks for the PR!

The input range component wasn't designed to handle float values, so I just extended it, please find my change in the b3a4e60 on your branch.

I also noticed couple of syntax issues that prevented app from being built, please find them in inline comments. To setup the repo and run the app, feel free to consult the README.md file in the root, it's quite simple (you only need Node.js).

Thanks again!

v-model="paramX"
v-bind:min="-0.99"
v-bind:max="0.99"
setp="0.01"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop name is step.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please bind the float value so it's correctly passed to the component (see min/max above).

v-model="paramY"
v-bind:min="-0.99"
v-bind:max="0.99"
setp="0.01"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prop name is step.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please bind the float value so it's correctly passed to the component (see min/max above).

while (i <= n_points / 2) {
const theta = alpha * i;
const xc1 = Math.cos(theta) * r;
const yc2 = Math.sin(theta) * r;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is unused?!

// for each point, find line y = m*x + n passing by (0,0) and (x,y)
const n = 0;
const m = (yc1 - n) / xc1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yc1 is undefined, perhaps it should be yc2 defined above?

},
computed: {
circlePoints () {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The circlePoints computed property should return circle points sorted in logical order, because linePoints depends on that. At the moment the final result is somewhat unexpected, because lines are not correctly drawn. You can check this out by running the generator on the unmodified code, and then comparing its output with your branch, when the center x/y displacement is 0/0 (should result in the same image).

@dvuckovic dvuckovic added the enhancement New feature or request label Feb 23, 2021
@dvuckovic dvuckovic assigned dvuckovic and unassigned dvuckovic Feb 23, 2021
@nicolau-manubens
Copy link
Author

Thanks @dvuckovic! I will address all that when I have the chance.

@dvuckovic dvuckovic force-pushed the main branch 2 times, most recently from b4d6dbc to f586e6c Compare February 23, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants