Skip to content

Commit

Permalink
[bugfix] Fixed coordinates and rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Dec 7, 2018
1 parent 64b7794 commit 5d5e3bc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/vision/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func ProtoToPackage(frame *sslproto.SSL_DetectionFrame, geometry *sslproto.SSL_G

func createBallShape(ball *sslproto.SSL_DetectionBall) Circle {
return Circle{
Center: Point{*ball.X, *ball.Y},
Center: Point{*ball.X, -*ball.Y},
Radius: ballRadius,
Style: Style{
StrokeWidth: &ballStrokeWidth,
Expand All @@ -62,8 +62,8 @@ func addGeometryShapes(pack *Package, geometry *sslproto.SSL_GeometryData) {
pack.GoalDepth = float32(*geometry.Field.GoalDepth)
for _, line := range geometry.Field.FieldLines {
pack.Lines = append(pack.Lines, Line{
P1: Point{*line.P1.X, *line.P1.Y},
P2: Point{*line.P2.X, *line.P2.Y},
P1: Point{*line.P1.X, -*line.P1.Y},
P2: Point{*line.P2.X, -*line.P2.Y},
Style: Style{
Stroke: &white,
StrokeWidth: &lineWidth,
Expand All @@ -72,7 +72,7 @@ func addGeometryShapes(pack *Package, geometry *sslproto.SSL_GeometryData) {
}
for _, arc := range geometry.Field.FieldArcs {
pack.Circles = append(pack.Circles, Circle{
Center: Point{*arc.Center.X, *arc.Center.Y},
Center: Point{*arc.Center.X, -*arc.Center.Y},
Radius: *arc.Radius,
Style: Style{
Stroke: &white,
Expand Down Expand Up @@ -111,7 +111,7 @@ func goalLinesPositive(geometry *sslproto.SSL_GeometryData) (lines []Line) {
func createBotPath(bot *sslproto.SSL_DetectionRobot, fillColor string) Path {
b := Bot{center2Dribbler, botRadius}
x := float64(*bot.X)
y := float64(*bot.Y)
y := -float64(*bot.Y)
o := float64(*bot.Orientation)
return Path{
D: []PathElement{
Expand Down Expand Up @@ -148,7 +148,7 @@ func createBotPath(bot *sslproto.SSL_DetectionRobot, fillColor string) Path {
func createBotId(bot *sslproto.SSL_DetectionRobot, strokeColor string) Text {
return Text{
Text: strconv.Itoa(int(*bot.RobotId)),
P: Point{*bot.X, *bot.Y},
P: Point{*bot.X, -*bot.Y},
Style: Style{
Fill: &strokeColor,
},
Expand All @@ -165,17 +165,17 @@ func (b Bot) orient2CornerAngle() float64 {
}

func (b Bot) botRightX(orientation float64) float64 {
return math.Cos(orientation+b.orient2CornerAngle()) * b.botRadius
return math.Cos(-orientation+b.orient2CornerAngle()) * b.botRadius
}

func (b Bot) botRightY(orientation float64) float64 {
return math.Sin(orientation+b.orient2CornerAngle()) * b.botRadius
return math.Sin(-orientation+b.orient2CornerAngle()) * b.botRadius
}

func (b Bot) botLeftX(orientation float64) float64 {
return math.Cos(orientation-b.orient2CornerAngle()) * b.botRadius
return math.Cos(-orientation-b.orient2CornerAngle()) * b.botRadius
}

func (b Bot) botLeftY(orientation float64) float64 {
return math.Sin(orientation-b.orient2CornerAngle()) * b.botRadius
return math.Sin(-orientation-b.orient2CornerAngle()) * b.botRadius
}

0 comments on commit 5d5e3bc

Please sign in to comment.