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;        

 

posted @ 2023-11-08 16:17  Solo李  阅读(62)  评论(0编辑  收藏  举报