feat(studio.resource): 增加了材料-晶格的力学关系

密度比 => k * 硬度 ^ a

Signed-off-by: 李东云 <dongyun.li@luxcreo.ai>
This commit is contained in:
李东云
2022-07-22 14:19:40 +08:00
parent 15a169fa94
commit 8f83455a31
2 changed files with 33 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ class Lattice extends JsonResource
'c0' => (float)$this->c0,
'scalingRatio' => (float)$this->pivot->scaling_ratio,
'evaluation' => LatticeEvaluation::make($this->evaluation),
'material' => Material::collection($this->material),
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Material.php@LuxStudio
*
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/7/21
*/
declare(strict_types=1);
namespace Singularity\HDK\Studio\Resource;
use Hyperf\Resource\Json\JsonResource;
use Singularity\HDK\Utils\Resource\ClassicResponse;
class Material extends JsonResource
{
use ClassicResponse;
public function toArray(): array
{
return [
'name' => $this->name,
// 密度比
'densityRatio' => [
'k' => $this->pivot->k,
'a' => $this->pivot->a,
],
];
}
}