… | |
… | |

78 | unless $line->type eq 'Vector'; |
78 | unless $line->type eq 'Vector'; |

79 | $t = shift || (keys %{$line->{variables}})[0]; |
79 | $t = shift || (keys %{$line->{variables}})[0]; |

80 | Value::Error("A line can't be just a constant vector") unless $t; |
80 | Value::Error("A line can't be just a constant vector") unless $t; |

81 | $p = Value::Point->new($line->eval($t=>0)); |
81 | $p = Value::Point->new($line->eval($t=>0)); |

82 | $v = Value::Vector->new($line->eval($t=>1) - $p); |
82 | $v = Value::Vector->new($line->eval($t=>1) - $p); |

83 | Value::Error("Your formula isn't linear in the variable $t") |
83 | Value::Error("Your formula isn't linear in the variable %s",$t) |

84 | unless $line == $p + Value::Formula->new($t) * $v; |
84 | unless $line == $p + Value::Formula->new($t) * $v; |

85 | } |
85 | } |

86 | Value::Error("The direction vector for a parametric line can't be the zero vector") |
86 | Value::Error("The direction vector for a parametric line can't be the zero vector") |

87 | if ($v->norm == 0); |
87 | if ($v->norm == 0); |

88 | $line->{p} = $p; $line->{v} = $v; |
88 | $line->{p} = $p; $line->{v} = $v; |