src/STLSplit.php
public function split() : array
    {
        $stlArray = $this->getStl()->toArray();
        $facets = $stlArray["facets"];

        $objArray = array();
        $vertex = $facets[0];
        unset($facets[0]);

        $current = 0;
        $objArray[$current] = array($vertex);
        while (count($facets) != 0) {
            $this->findNeighbour(
                $vertex,
                $objArray[$current],
                $facets
            );
            $vertex = array_pop($facets);
            $current++;
            if ($vertex) {
                $objArray[$current] = array($vertex);
            }
        }

        $stlObjects = array();
        foreach ($objArray as $key => $object) {
            $stlObjects[] = STL::fromArray(array(
                "name" => $this->getStl()->getSolidName() . $key,
                "facets" => $object
            ));
        }

        return $stlObjects;
    }
public function split() : array
    {
        $stlArray = $this->getStl()->toArray();
        $facets = $stlArray["facets"];

        $objArray = array();
        $vertex = $facets[0];
        unset($facets[0]);

        $current = 0;
        $objArray[$current] = array($vertex);
        while (count($facets) != 0) {
            $this->findNeighbour(
                $vertex,
                $objArray[$current],
                $facets
            );
            $vertex = array_pop($facets);
            $current++;
            if ($vertex) {
                $objArray[$current] = array($vertex);
            }
        }

        $stlObjects = array();
        foreach ($objArray as $key => $object) {
            $stlObjects[] = STL::fromArray(array(
                "name" => $this->getStl()->getSolidName() . $key,
                "facets" => $object
            ));
        }

        return $stlObjects;
    }
public function split ( ) : array { $ stlArray = $ this -> getStl ( ) -> toArray ( ) ; $ facets = $ stlArray [ "facets" ] ; $ objArray = array ( ) ; $ vertex = $ facets [ 0 ] ; unset ( $ facets [ 0 ] ) ; $ current = 0 ; $ objArray [ $ current ] = array ( $ vertex ) ; while ( count ( $ facets ) != 0 ) { $ this -> findNeighbour ( $ vertex , $ objArray [ $ current ] , $ facets ) ; $ vertex = array_pop ( $ facets ) ; $ current ++ ; if ( $ vertex ) { $ objArray [ $ current ] = array ( $ vertex ) ; } } $ stlObjects = array ( ) ; foreach ( $ objArray as $ key => $ object ) { $ stlObjects [ ] = STL :: fromArray ( array ( "name" => $ this -> getStl ( ) -> getSolidName ( ) . $ key , "facets" => $ object ) ) ; } return $ stlObjects ; }
Splits an STL object and returns the new 3D objects in an array of STL files.

@return array
Splits an STL object and returns the new 3D objects in an array of STL files .