Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
matefun
Frontend
Commits
da0147cf
Commit
da0147cf
authored
Nov 12, 2017
by
Gonzalo Fabian Cameto Hernandez
Browse files
Mejoras en la renderización de funciones
parent
648682c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Frontend Angular 4/src/app/layout/canvas/canvas.component.ts
View file @
da0147cf
...
...
@@ -176,7 +176,7 @@ export class CanvasComponent {
this
.
unitY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
this
.
centerY
=
(
-
this
.
minY
/
this
.
rangeY
)
*
this
.
canvasRef
.
nativeElement
.
height
;
this
.
centerX
=
(
-
this
.
minX
/
this
.
rangeX
)
*
this
.
canvasRef
.
nativeElement
.
width
;
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
1000
;
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
this
.
precision
;
this
.
scaleX
=
this
.
canvasRef
.
nativeElement
.
width
/
this
.
rangeX
;
this
.
scaleY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
...
...
@@ -337,7 +337,8 @@ export class CanvasComponent {
this
.
unitY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
this
.
centerY
=
Math
.
round
(
Math
.
abs
(
this
.
minY
/
this
.
rangeY
)
*
this
.
canvasRef
.
nativeElement
.
height
);
this
.
centerX
=
Math
.
round
(
Math
.
abs
(
this
.
minX
/
this
.
rangeX
)
*
this
.
canvasRef
.
nativeElement
.
width
);
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
1000
;
this
.
precision
=
1000
;
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
this
.
precision
;
this
.
scaleX
=
this
.
canvasRef
.
nativeElement
.
width
/
this
.
rangeX
;
this
.
scaleY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
};
...
...
@@ -753,7 +754,7 @@ export class CanvasComponent {
this
.
unitY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
this
.
centerY
=
(
this
.
maxY
/
this
.
rangeY
)
*
this
.
canvasRef
.
nativeElement
.
height
;
this
.
centerX
=
(
-
this
.
minX
/
this
.
rangeX
)
*
this
.
canvasRef
.
nativeElement
.
width
;
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
1000
;
this
.
iteration
=
(
this
.
maxX
-
this
.
minX
)
/
this
.
precision
;
this
.
scaleX
=
this
.
canvasRef
.
nativeElement
.
width
/
this
.
rangeX
;
this
.
scaleY
=
this
.
canvasRef
.
nativeElement
.
height
/
this
.
rangeY
;
...
...
@@ -889,15 +890,20 @@ export class CanvasComponent {
context
.
beginPath
();
context
.
lineWidth
=
thickness
;
try
{
context
.
moveTo
(
this
.
minX
,
equation
(
this
.
minX
));
var
firstPoint
=
equation
(
this
.
minX
);
if
(
firstPoint
>
10
e6
){
firstPoint
=
10
e6
;
}
else
if
(
firstPoint
<-
10
e6
){
firstPoint
=
-
10
e6
;
}
context
.
moveTo
(
this
.
minX
,
firstPoint
);
var
move
=
true
;
var
_x
=
undefined
;
var
_y
=
undefined
;
var
pendiente
=
undefined
;
var
delta
=
0.50
;
var
nuevoY
=
undefined
;
var
h
=
1
/
1000
;
var
delta
=
this
.
rangeX
/
1000
;
var
h
=
1
/
this
.
precision
;
var
delta
=
this
.
rangeX
/
this
.
precision
;
var
anchoPunto
=
this
.
rangeX
/
200
;
for
(
var
x
=
this
.
minX
+
this
.
iteration
;
x
<=
this
.
maxX
;
x
+=
this
.
iteration
)
{
try
{
...
...
@@ -915,17 +921,15 @@ export class CanvasComponent {
}
else
{
if
(
pendiente
!=
undefined
){
var
diff
=
Math
.
abs
(
Math
.
abs
(
nuevoY
)
-
Math
.
abs
(
y
));
var
pendienteMas1
=
Math
.
tan
(
Math
.
atan
(
pendiente
)
+
Math
.
PI
/
8
);
var
pendienteMenos1
=
Math
.
tan
(
Math
.
atan
(
pendiente
)
-
Math
.
PI
/
8
);
if
(
pendiente
>
0
&&
pendienteMas1
<
0
){
pendienteMas1
=
1000000
;
pendienteMas1
=
1
e20
;
//Number.MAX_VALUE;//
1000000;
}
if
(
pendiente
<
0
&&
pendienteMenos1
>
0
){
pendienteMenos1
=
-
1000000
;
pendienteMenos1
=
-
1
e20
;
//Number.MIN_VALUE;//
-1000000;
}
var
max
=
(
x
-
_x
)
*
pendienteMas1
-
(
y
-
_y
);
...
...
@@ -939,17 +943,17 @@ export class CanvasComponent {
pendiente
=
(
y
-
_y
)
/
(
x
-
_x
);
}
var
copiaY
=
y
;
if
(
y
>
10
e6
){
y
=
10
e6
;
copiaY
=
10
e6
;
}
else
if
(
y
<-
10
e6
){
y
=
-
10
e6
;
copiaY
=
-
10
e6
;
}
if
(
move
){
context
.
moveTo
(
x
,
y
);
context
.
moveTo
(
x
,
copiaY
);
move
=
false
;
}
else
{
context
.
lineTo
(
x
,
y
);
context
.
lineTo
(
x
,
copiaY
);
}
}
_x
=
x
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment