【发布时间】:2020-05-19 03:39:35
【问题描述】:
data Geometry = Point {xCoord:: Double
,yCoord:: Double} |Line {xCoeff:: Double
,yCoeff:: Double
,constant:: Double}|Plane {xCoeff:: Double,yCoeff:: Double,
zCoeff::Double,
constant::Double} deriving (Show)
intersection:: Geometry -> Geometry -> Either String Geometry
intersection (Line a1 b1 c1) (Line a2 b2 c2)
| #### some code
intersection (Plane a1 b1 c1 d1) (Plane a2 b2 c2 d2)
| #### some code
| n1_n2_z /= 0 = Right $ParamerticLine (Point3D t1 (cond12/n1_n2_z) 0) (Point3D n1_n2_x n1_n2_y n1_n2_z)
| otherwise ## some code
where {Point t1 t2 = intersection (Line a1 b1 d1) (Line a2 b2 d2)}
我正在尝试计算平面交集的 where 子句中的线交点,并在条件 n1_n2_z/=0 中使用 t1。我收到 where 子句的错误。我可以使用 where 子句中定义的交集函数吗?我在 where 子句中做错了什么?
【问题讨论】:
-
你能分享一下错误吗?