Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Fixed badges
  Fixed
  Fixed
  • Loading branch information
HarutakaMatsumoto committed Jan 17, 2024
2 parents 6c21970 + 448f611 commit 07664e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
15 changes: 7 additions & 8 deletions Measure.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// You get the distance or the depth between them in passing.
//
// The fundamental structure is [Measure]. An [Measure] contains two convex hulls, so
// you must set at the first. Then, you can measure the distance or the depth between
// them by calling [MeasureDistance] or [MeasureNonnegativeDistance] with the closest points.
// You can reuse [Measure] any number of times. [Measure] stroes the result of the last
// you must set them at the first. Then, you can measure the distance or the depth between
// them by calling [Measure.MeasureDistance] or [Measure.MeasureNonnegativeDistance] with the closest points.
// You can reuse [Measure] any number of times. [Measure] stores the last
// direction from the first convex hull to the second convex hull, so it can calculate
// the closest points of the convex hulls faster than the first time.
package closest
Expand All @@ -20,7 +20,7 @@ import (
type Measure struct {
// In
// ConvexHulls are measured the distance between them.
// The less degenerate the convex hull, the more accurate the result.
// The less degenerate the convex hull, the more precise the result.
ConvexHulls [2][]*mgl64.Vec3

// Out
Expand All @@ -33,7 +33,7 @@ type Measure struct {
Direction mgl64.Vec3
// Points are the closest points on each convex hulls.
Points [2]mgl64.Vec3
// Ons are set of the vertex indices which the closest points are on the face constructed.
// Ons are the sets of indices of the vertices that make up the simplex that contains the closest point.
Ons [2]map[int]struct{}

simplex []*vertex
Expand Down Expand Up @@ -61,7 +61,7 @@ func (measure *Measure) MeasureDistance() {
measure.epa()
}

// MeasureNonnegativeDistance measures distance between each ConvexHulls, and updates Direction, Points and Ons
// MeasureNonnegativeDistance measures distance between each ConvexHulls, and updates Direction, Points and Ons.
func (measure *Measure) MeasureNonnegativeDistance() {
for _, convex := range measure.ConvexHulls {
if len(convex) == 0 {
Expand Down Expand Up @@ -129,8 +129,7 @@ func (measure *Measure) epa() {
faces = append(faces, newFace)
}
default:
log.Print("Must not come here!")
return
log.Panic("Must not come here!")
}

sort.Slice(faces, func(i int, j int) bool {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# closest

[![GoDoc](https://pkg.go.dev/badge/github.com/trajectoryjp/closest_go)][API]
[![GoReportCard](https://goreportcard.com/badge/trajectoryjp/closest_go)](https://goreportcard.com/report/github.com/trajectoryjp/closest_go)
[![Go Doc](https://pkg.go.dev/badge/github.com/trajectoryjp/closest_go)](https://pkg.go.dev/github.com/trajectoryjp/closest_go)
[![Go Report Card](https://goreportcard.com/badge/github.com/trajectoryjp/closest_go)](https://goreportcard.com/report/github.com/trajectoryjp/closest_go)

Go module closest provides you calculating the closest points of two convex hulls.
You get the distance or the depth between them in passing.
Expand All @@ -20,7 +20,7 @@ will automatically fetch the necessary dependencies:
import "github.com/trajectoryjp/closest_go"
```

## Contribute
## Contribution

You are very welcome to:

Expand Down
6 changes: 3 additions & 3 deletions vertex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

type vertex struct {
indices [2]int
coordinate mgl64.Vec3
indices [2]int
coordinate mgl64.Vec3
barycentricCoordinate float64
isVisited bool
isVisited bool
}

func newVertex(convexes [2][]*mgl64.Vec3, direction mgl64.Vec3) *vertex {
Expand Down

0 comments on commit 07664e3

Please sign in to comment.