我希望在一个圆上绘制角度线(我在脚本中更改角度)。我得到的绘图线是0角,为什么脚本没有向我显示所有角度,如何解决? 另外,如何计算相交点?
脚本:
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void){
if let userID = notification.request.content.userInfo["user_id"] {
self.userIDSelected = userID as! String
}
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.removeAllDeliveredNotifications()
if self.currentuserID != self.userIDSelected
{
completionHandler([.alert,.badge,.sound])
}
else
{
completionHandler([])
}
}
答案 0 :(得分:1)
我认为您的 abstract class BoundedNumber(val lowerBound: Double,
val upperBound: Double,
val value: Double) {
require(value >= lowerBound && value <= upperBound)
def copy(value: Double): BoundedNumber
def +(that: BoundedNumber): BoundedNumber = {
require(this.getClass == that.getClass)
that.copy(value + that.value)
}
}
final case class Percentage(override val value: Double) extends BoundedNumber(0, 100, value) {
override def copy(value: Double): BoundedNumber = Percentage(value)
}
final case class Probability(override val value: Double) extends BoundedNumber(0, 1, value){
override def copy(value: Double): BoundedNumber = Probability(value)
}
循环的定义有误。步长必须出现在迭代的开始和结束之间的中间位置:
for
此外,MATLAB使用弧度指定角度,因此360°等于2pi,您必须相应地更改输入。
对于线和圆的交点,我会在实现之前考虑几何形状;)