Coder Social home page Coder Social logo

Comments (4)

DOSull avatar DOSull commented on September 22, 2024

I am seeing the same behaviour, where I expect PA to emerge unscathed from the triangulation it ends up 'row-wise' in the output not 'column-wise':

tri <- pslg(P = tpts, PA = tattrs) %>%
  triangulate()

> head(tattrs)
           x       y
1  -428675.9 1520344
2 -1197290.8 7794188
3 -1120150.7 7234575
4 -1048583.9 6613223
5  -973499.6 5945572
6  -892969.4 5242144
> head(tri$PA)
           [,1]       [,2]
[1,]  -428675.9 -1197290.8
[2,] -1120150.7 -1048583.9
[3,]  -973499.6  -892969.4
[4,]  -807038.3  -716485.6
[5,]  -622414.4  -526061.0
[6,] -1524302.5 -1417125.3

from rtriangle.

DOSull avatar DOSull commented on September 22, 2024

For what it's worth, I can untangle the attributes matrix with this function, but obviously would be a lot better to fix it at source!

untangle <- function(triPA) { 
  return ( matrix( c( t( triPA ) ), ncol = dim(triPA)[2] ) );
}

or with pipes

untangle <- function(triPA) {
  nc <- dim(triPA)[2]
  return (triPA %>% 
            t() %>%               # transpose
            c() %>%               # vectorise
            matrix(ncol = nc))    # column-wise repopulate the original shape
}

from rtriangle.

davidcsterratt avatar davidcsterratt commented on September 22, 2024

Sorry for the delay in looking at this. It would indeed be desirable to fix the issue. I have been very busy, but I hope to have some time next week (during my holiday) to look at it properly.

from rtriangle.

DOSull avatar DOSull commented on September 22, 2024

This isn't more important than your holiday (at least not for me)! I assume the issue is some kind of index inversion when you are populating the output PA matrix

from rtriangle.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.