Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soma contour centroid oriented so 1 end is largest positive direction. #2491

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions share/lib/hoc/import3d/import3d_gui.hoc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,21 @@ proc contour2centroid() {local i, j, imax, imin, ok localobj mean, pts, d, max,
tobj = m.symmeig(m)
// major axis is the one with largest eigenvalue
major = m.getcol(tobj.max_ind)
// For plotting and round-off error consistency
// between meschach and eigen use the heuristic that
// major axis points in positive direction.
// i.e. if greatest value is negative, reverse orientation.
if (major.x[major.c.abs().max_ind()] < 0) {
major.mul(-1)
}
// minor is normal and in xy plane
minor = m.getcol(3-tobj.min_ind-tobj.max_ind)
minor.x[2] = 0
minor.div(minor.mag)
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
d = new Vector(pts.ncol)
rad = new Vector(pts.ncol)
for i=0, pts.ncol-1 {
Expand Down