[Kstars-devel] Drawing Geodesic Domes on the Sky

James Bowlin bowlin at mindspring.com
Wed May 31 01:31:44 CEST 2006


I fixed the bug in getting the corners of the triangles.

Here is a patch:
# Fixes segfaults and random vertices from SpatialIndex::nodeVertex()
# when buildlevel == maxlevel_
# -- James Bowlin

--- code/htm/src/SpatialIndex.cpp 2003-01-22 09:20:38.000000000 -0700
+++ perl/htm/src/SpatialIndex.cpp 2006-05-30 16:42:57.000000000 -0600
@@ -143,7 +143,7 @@
                         SpatialVector & v2) const {

   if(buildlevel_ == maxlevel_) {
-    uint32 idx = (uint32)id;
+    uint32 idx = (uint32)id  - leaves_ + IOFFSET;  // -jbb: Fix segfault. See "idx =" below.
        v0 = vertices_[nodes_[idx].v_[0]];
     v1 = vertices_[nodes_[idx].v_[1]];
     v2 = vertices_[nodes_[idx].v_[2]];


The lines below that I refer to are:

  uint64 sid = id >> ((maxlevel_ - buildlevel_)*2);
  uint32 idx = (uint32)(sid - storedleaves_ + IOFFSET);


--
Peace, James


More information about the Kstars-devel mailing list