Mercurial > gemma
comparison pkg/mesh/meshserialize_v2.go @ 5700:45240edad249 sr-v2
Make Go 1.21 compatible.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 13 Feb 2024 23:05:59 +0100 |
parents | ef80748ae4f3 |
children | fe83406fe7ed |
comparison
equal
deleted
inserted
replaced
5699:a3a975ea93ca | 5700:45240edad249 |
---|---|
64 if err := binary.Write(w, binary.LittleEndian, uint32(len(vertices))); err != nil { | 64 if err := binary.Write(w, binary.LittleEndian, uint32(len(vertices))); err != nil { |
65 return err | 65 return err |
66 } | 66 } |
67 m := t.Min | 67 m := t.Min |
68 buf := make([]byte, binary.MaxVarintLen64) | 68 buf := make([]byte, binary.MaxVarintLen64) |
69 for dim := range 3 { | 69 for dim := 0; dim <= 2; dim++ { |
70 delta := common.Delta() | 70 delta := common.Delta() |
71 for i := range vertices { | 71 for i := range vertices { |
72 var v float64 | 72 var v float64 |
73 switch dim { | 73 switch dim { |
74 case 0: | 74 case 0: |
222 return err | 222 return err |
223 } | 223 } |
224 vertices := make([]Vertex, numVertices) | 224 vertices := make([]Vertex, numVertices) |
225 t.Vertices = vertices | 225 t.Vertices = vertices |
226 m := t.Min | 226 m := t.Min |
227 for dim := range 3 { | 227 for dim := 0; dim <= 2; dim++ { |
228 invDelta := common.InvDelta() | 228 invDelta := common.InvDelta() |
229 for i := range vertices { | 229 for i := range vertices { |
230 d, err := binary.ReadVarint(r) | 230 d, err := binary.ReadVarint(r) |
231 if err != nil { | 231 if err != nil { |
232 return err | 232 return err |
309 | 309 |
310 // sortVertices so that the deltas between neighbors are minimized. | 310 // sortVertices so that the deltas between neighbors are minimized. |
311 func (s *STRTree) sortVertices() { | 311 func (s *STRTree) sortVertices() { |
312 vertices := s.tin.Vertices | 312 vertices := s.tin.Vertices |
313 indices := make([]int32, len(vertices)) | 313 indices := make([]int32, len(vertices)) |
314 for i := range len(indices) { | 314 for i := range indices { |
315 indices[i] = int32(i) | 315 indices[i] = int32(i) |
316 } | 316 } |
317 | 317 |
318 // Take aspect ratio of bbox into account. | 318 // Take aspect ratio of bbox into account. |
319 width := s.tin.Max.X - s.tin.Min.X | 319 width := s.tin.Max.X - s.tin.Min.X |