//--------------------------------------------------------- bool CKriging_Simple::Get_Weights(const CSG_Points_Z &Points, CSG_Matrix &W) { int n = Points.Get_Count(); if( n > 0 ) { int n = Points.Get_Count(); W.Create(n, n); for(int i=0; i<n; i++) { W[i][i] = 0.0; // diagonal... for(int j=i+1; j<n; j++) { W[i][j] = W[j][i] = Get_Weight(Points.Get_X(i), Points.Get_Y(i), Points.Get_X(j), Points.Get_Y(j)); } } return( W.Set_Inverse(!m_Search.Do_Use_All(), n) ); } return( false ); }
//--------------------------------------------------------- bool CGridding_Spline_Base::_Get_Points(CSG_Points_Z &Points, bool bInGridOnly) { Points.Clear(); if( m_bGridPoints ) { int x, y; TSG_Point p; CSG_Grid *pGrid = Parameters("GRIDPOINTS") ->asGrid(); for(y=0, p.y=pGrid->Get_YMin(); y<pGrid->Get_NY() && Set_Progress(y, pGrid->Get_NY()); y++, p.y+=pGrid->Get_Cellsize()) { for(x=0, p.x=pGrid->Get_XMin(); x<pGrid->Get_NX(); x++, p.x+=pGrid->Get_Cellsize()) { if( !pGrid->is_NoData(x, y) && (!bInGridOnly || m_pGrid->is_InGrid_byPos(p)) ) { Points.Add(p.x, p.y, pGrid->asDouble(x, y)); } } } } else { CSG_Shapes *pShapes = Parameters("SHAPES") ->asShapes(); int zField = Parameters("FIELD") ->asInt(); for(int iShape=0; iShape<pShapes->Get_Count() && Set_Progress(iShape, pShapes->Get_Count()); iShape++) { CSG_Shape *pShape = pShapes->Get_Shape(iShape); if( !pShape->is_NoData(zField) ) { double zValue = pShape->asDouble(zField); for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++) { for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++) { TSG_Point p = pShape->Get_Point(iPoint, iPart); if( !bInGridOnly || m_pGrid->is_InGrid_byPos(p) ) { Points.Add(p.x, p.y, zValue); } } } } } } return( Points.Get_Count() >= 3 ); }
//--------------------------------------------------------- size_t CSG_PRQuadTree::Get_Nearest_Points(CSG_Points_Z &Points, double x, double y, size_t maxPoints, double Radius, int iQuadrant) const { CSG_Array Selection; _Select_Nearest_Points(Selection, x, y, maxPoints, Radius, iQuadrant); Points.Clear(); for(size_t i=0; i<Selection.Get_Size(); i++) { CSG_PRQuadTree_Leaf *pLeaf = _Get_Selected(Selection, i)->pLeaf; Points.Add(pLeaf->Get_X(), pLeaf->Get_Y(), pLeaf->Get_Z()); } return( Points.Get_Count() ); }