/** * @covers tarcisio\p2d\Line::isHorizontal */ public function testIsHorizontal() { $line = new Line(5, 10, 20, 10); $this->assertTrue($line->isHorizontal()); $line = new Line(5, 10, 20, 15); $this->assertFalse($line->isHorizontal()); }
/** * Center Y values of the axis * * @param awAxis $axis An axis * @param float $value The reference value on the axis */ public function setYCenter(awAxis $axis, $value) { // Check vector angle if ($this->line->isHorizontal() === FALSE) { trigger_error("setYCenter() can only be used on horizontal axes", E_USER_ERROR); } $p = $axis->getPointFromValue($value); $this->line->setY($p->y, $p->y); }
/** * Center Y values of the axis * * @param awAxis $axis An axis * @param float $value The reference value on the axis */ public function setYCenter(awAxis $axis, $value) { // Check vector angle if ($this->line->isHorizontal() === FALSE) { awImage::drawError("Class Axis: setYCenter() can only be used on horizontal axes."); } $p = $axis->getPointFromValue($value); $this->line->setY($p->y, $p->y); }