代码拉取完成,页面将自动刷新
// Copyright 2017-2020 The ShadowEditor Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
//
// For more information, please visit: https://github.com/tengge1/ShadowEditor
// You can also visit: https://gitee.com/tengge1/ShadowEditor
//
// This package is translated from three.js, visit `https://github.com/mrdoob/three.js`
// for more information.
package three
import (
"math"
)
// NewCylindrical create a new Cylindrical
func NewCylindrical(radius, theta, y float64) *Cylindrical {
return &Cylindrical{radius, theta, y}
}
// Cylindrical :
type Cylindrical struct {
Radius float64 // distance from the origin to a point in the x-z plane
Theta float64 // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
Y float64 // height above the x-z plane
}
// Set :
func (c Cylindrical) Set(radius, theta, y float64) *Cylindrical {
c.Radius = radius
c.Theta = theta
c.Y = y
return &c
}
// Clone :
func (c Cylindrical) Clone() *Cylindrical {
return &Cylindrical{c.Radius, c.Theta, c.Y}
}
// Copy :
func (c Cylindrical) Copy(other *Cylindrical) *Cylindrical {
c.Radius = other.Radius
c.Theta = other.Theta
c.Y = other.Y
return &c
}
// setFromVector3 :
func (c Cylindrical) setFromVector3(v Vector3) *Cylindrical {
return c.SetFromCartesianCoords(v.X, v.Y, v.Z)
}
// SetFromCartesianCoords :
func (c Cylindrical) SetFromCartesianCoords(x, y, z float64) *Cylindrical {
c.Radius = math.Sqrt(x*x + z*z)
c.Theta = math.Atan2(x, z)
c.Y = y
return &c
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。