本文整理汇总了Golang中util/vec.Vectorer.Slice方法的典型用法代码示例。如果您正苦于以下问题:Golang Vectorer.Slice方法的具体用法?Golang Vectorer.Slice怎么用?Golang Vectorer.Slice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util/vec.Vectorer
的用法示例。
在下文中一共展示了Vectorer.Slice方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewTwist
func NewTwist(w, q vec.Vectorer) Twister {
t := new(twist)
t.w = w // set the axis of motion of joint
t.q = q // set the position a point on the axis of joint
t.v = vec.Zeros(AxisLength)
t.v.Cross(q, w) // qxw
t.t = mesh.Gen(nil, TwistLength, 1)
tvec := t.t.Vec().Slice()
copy(tvec[3:], w.Slice())
copy(tvec[:3], t.v.Slice())
return t
}
示例2: SetCol
// SetCol sets the c'th column of m with vector, v
func (m *mesh) SetCol(v vec.Vectorer, c int) {
for i, e := range v.Slice() {
m.elems.SetAt(i*m.off+c, e)
}
}
示例3: SetRow
// SetRow sets the r'th column of m with vector, v
func (m *mesh) SetRow(v vec.Vectorer, r int) {
off := r * m.off
for j, e := range v.Slice() {
m.elems.SetAt(off+j, e)
}
}
示例4: GetCol
// GetCol returns the c'th column of m into vector, v
// of length equal to no. of rows of mesh
func (m mesh) GetCol(v vec.Vectorer, c int) {
off := m.off
for i := range v.Slice() {
v.SetAt(i, m.elems.GetAt(i*off+c))
}
}
示例5: GetRow
// GetRow returns the r'th column of m into vector, v
// of length equal to no. of cols of mesh
func (m mesh) GetRow(v vec.Vectorer, r int) {
off := r * m.off
for j := range v.Slice() {
v.SetAt(j, m.elems.GetAt(off+j))
}
}
示例6: SetDiag
// SetDiag puts the diagonal, d into the mesh
// m must be a square matrix
func (m *mesh) SetDiag(d vec.Vectorer) {
for e := range d.Slice() {
m.SetAtNode(d.GetAt(e), e, e)
}
}
示例7: GetDiag
// GetDiag puts the diagonal of the mesh into
// the vector, m must be a square matrix
func (m mesh) GetDiag(d vec.Vectorer) {
for e := range d.Slice() {
d.SetAt(e, m.GetAtNode(e, e))
}
}