46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace swf2ass;
|
|
|
|
class CubicSplineCurveRecord implements Record {
|
|
public Vector2 $start;
|
|
/** @var Vector2[] */
|
|
public array $control;
|
|
public Vector2 $anchor;
|
|
|
|
/**
|
|
* @param Vector2[] $control
|
|
* @param Vector2 $anchor
|
|
* @param Vector2 $start
|
|
*/
|
|
public function __construct(array $control, Vector2 $anchor, Vector2 $start) {
|
|
$this->control = $control;
|
|
$this->anchor = $anchor;
|
|
$this->start = $start;
|
|
}
|
|
|
|
public function getStart(): Vector2 {
|
|
return $this->start;
|
|
}
|
|
|
|
public function reverse(): CubicSplineCurveRecord {
|
|
return new CubicSplineCurveRecord(array_reverse($this->control), $this->start, $this->anchor);
|
|
}
|
|
|
|
public function applyMatrixTransform(MatrixTransform $transform): CubicSplineCurveRecord {
|
|
$control = [];
|
|
foreach ($this->control as $c) {
|
|
$control[] = $transform->applyToVector($c);
|
|
}
|
|
|
|
return new CubicSplineCurveRecord($control, $transform->applyToVector($this->anchor), $transform->applyToVector($this->start));
|
|
}
|
|
|
|
public function append(Record $record): ?CubicSplineCurveRecord {
|
|
if ($record instanceof CubicCurveRecord) {
|
|
|
|
}
|
|
|
|
return null;
|
|
}
|
|
} |