Skip to content

Commit

Permalink
function drawing fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAsmirko committed Mar 12, 2021
1 parent 4981e1c commit 0ea8f97
Show file tree
Hide file tree
Showing 74 changed files with 19 additions and 14 deletions.
Binary file modified .gradle/6.7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/6.7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/6.7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/6.7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified build/classes/kotlin/main/Constants.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/LeftViewType.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$buttonInBox$1$1$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$buttonInBox$1$2$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$buttonInBox$1$3$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$buttonInBox$1$4.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$drawPoints$sorted$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$2.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$3.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$4.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$5.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$functionsButtonsText$6.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$1$1$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$10.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$11$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$2$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$3$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$4$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$5$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$6.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$7$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$8.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$1$9$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1$1$2.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$main$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt$plotView$1.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MainKt.class
Binary file not shown.
Binary file modified build/classes/kotlin/main/MethodType.class
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/build-history.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
é
á
Ø í í í í ñ À À À À À À Ä ý
ÀÀÀÀÃ
ÀÀÀÀÃÃÃÃÃÃÃÃÃÃÃÃ
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
джжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжьыыыыыыыыыыышшшшшшшдддьоооооИИИИИИИИИИИИз
джжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжьыыыыыыыыыыышшшшшшшдддьоооооИИИИИИИИИИИИзззззззззззз
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Юххххххххххххххххххххххххххххххххххххххххххххххххххт!м"У)У)У)У)У)Щ)У(У(У(У(У(У(о(Г)Г)Г)Г)Г)й(п(у)у.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.д.
Юххххххххххххххххххххххххххххххххххххххххххххххххххт!м"У)У)У)У)У)Щ)У(У(У(У(У(У(о(Г)Г)Г)Г)Г)й(п(у)у.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.в.д.Ц.Т.Т.Т.Т.Т.Т.Т.Т.Т.Т.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
�윌촌︌︌︌︌︌︌︌,︌︌︌︌,
�윌촌︌︌︌︌︌︌︌,︌︌︌︌,,,,,,,,,,,,
Binary file modified build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
120
117
131
128
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ηΫόμΟΞΙΦχέΙΥΓοΟξΙννεΦρ
ηΫόμΟΞΙΦχέΙΥΓοΟξΙννεΦρΩΗυύεΤΛΑΔΰξξΛυδ�ήςΰΪμΡώΚλίίοΧαΘμαΦϊΜύΥηκΜ�ΙΫΫιβ�ξΞΥΧΩνέίάΚαΤοΥζβΥψβϊς�ΘΠωγήλΚΝύΘδώλΠμαΑηΥξηάάςρωΚαχχΛΝΪψΜΦυΟΒΓΚΟχϊΨγθΨΩΨόΝΙβΡτΒδΜδϊλΕ
Expand Down
Binary file modified build/kotlin/compileKotlin/last-build.bin
Binary file not shown.
19 changes: 12 additions & 7 deletions src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import model.interpolators.FunctionInterpolator
import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO
import javax.swing.Icon
import kotlin.math.log2
import kotlin.math.pow
import kotlin.math.sin

object Constants {
const val POINT_RADIUS = 0.5f
const val POINT_RADIUS = 0.005f
const val TITLE = "Optimizer Visualizer"
const val NONE_FUNC = "NONE"
const val BACK_BUTTON = "BACK"
Expand Down Expand Up @@ -282,7 +281,9 @@ fun plotView(plotData: PlotData, height: Int, width: Int) {
Constants.POINT_RADIUS,
plotData.lBound,
plotData.minFnVal,
scale.first, paint
scale.first,
scale.second,
paint
)
restore()
}
Expand Down Expand Up @@ -319,9 +320,12 @@ fun Canvas.drawPoints(
radius: Float,
lBound: Float,
minFnVal: Float,
scale: Float,
scaleX: Float,
scaleY: Float,
paint: Paint
) {
save()
scale(1 / scaleX, 1 / scaleY)
val strokeWidthConst = 5f
val sorted = points.sortedWith(Comparator { o1, o2 ->
return@Comparator when {
Expand All @@ -333,16 +337,17 @@ fun Canvas.drawPoints(
var prevOffset: Offset? = null
paint.apply {
color = Color(0xff64dd17)
strokeWidth = strokeWidthConst / scale
strokeWidth = strokeWidthConst
}
for (i in sorted.indices) {
val curOffset = Offset(sorted[i].x - lBound, sorted[i].y - minFnVal)
this.drawCircle(curOffset, radius / scale, paint)
val curOffset = Offset((sorted[i].x - lBound) * scaleX, (sorted[i].y - minFnVal) * scaleY)
this.drawCircle(curOffset, radius, paint)
if (prevOffset != null) {
this.drawLine(prevOffset, curOffset, paint)
}
prevOffset = curOffset
}
restore()
}

fun Canvas.prepareAxis(
Expand Down

0 comments on commit 0ea8f97

Please sign in to comment.