PHP使用php_stl计算STL模型体积和表面积
使用composer安装chubv/php-stl包
<?php require_once 'vendor/autoload.php'; use PHPSTL\Handler\VolumeHandler; use PHPSTL\Handler\SurfaceHandler; use PHPSTL\Reader\STLReader; $reader = new STLReader(); $reader = $reader->forFile('./111.stl'); $handler = $reader->setHandler(new VolumeHandler()); $volume = $reader->readModel(); $handler = $reader->setHandler(new SurfaceHandler()); $area = $reader->readModel(); var_dump($area);die;