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

Кучеренко Александр #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sairen777
Copy link

I'm Кучеренко Александр btw

@disturm disturm changed the title Выполнил задание Кучеренко Александр Feb 26, 2017
Copy link

@disturm disturm left a comment

Choose a reason for hiding this comment

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

Код в целом хорош. Чувствуется, что JS я вам еще не рассказал :-)

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
var ax = Number(document.getElementById("point-one-x").value);
Copy link

Choose a reason for hiding this comment

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

А тут не надо сказать new Number? Хотя более явно - parseInt


function draw(points, context) {
context.beginPath();
for (var i = 0; i < points.length+1; i++) {
Copy link

Choose a reason for hiding this comment

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

Можно сделать цикл с границами i = 1; i < points.length. А хитрая логика внутри цикла исчезнет. Код станет более прямолинейным.

}

function makeFractPoints(points, n) {
for (n; n > 0; n--) {
Copy link

Choose a reason for hiding this comment

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

в таком случае можно писать for (; n> 0; n--), или просто использовать цикл while

var p = {x: a.x + 1/3*u.x, y: a.y + 1/3*u.y};
var q = {x: a.x + 1/2*u.x + Math.sqrt(3)/6*v.x, y: a.y + 1/2*u.y + Math.sqrt(3)/6*v.y};
var r = {x: a.x + 2/3*u.x, y: a.y + 2/3*u.y};
points.splice(counter + i + 1, 0 , r);
Copy link

Choose a reason for hiding this comment

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

кажется тебе здесь нужен метод push.

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

Successfully merging this pull request may close these issues.

2 participants