Golang C.dReal类(方法)实例源码

下面列出了Golang C.dReal 类(方法)源码代码实例,从而了解它的用法。

作者:bfosberr    项目:od   
// ImpulseToForce converts an impulse to a force over a step duration.
func (w World) ImpulseToForce(stepSize float64, impulse Vector3) Vector3 {
	force := NewVector3()
	C.dWorldImpulseToForce(w.c(), C.dReal(stepSize),
		C.dReal(impulse[0]), C.dReal(impulse[1]), C.dReal(impulse[2]),
		(*C.dReal)(&force[0]))
	return force
}

作者:bfosberr    项目:od   
// SetParams sets the mass parameters.
func (m *Mass) SetParams(mass float64, com Vector3, inert Matrix3) {
	c := &C.dMass{}
	C.dMassSetParameters(c, C.dReal(mass),
		C.dReal(com[0]), C.dReal(com[1]), C.dReal(com[2]),
		C.dReal(inert[0][0]), C.dReal(inert[1][1]), C.dReal(inert[2][2]),
		C.dReal(inert[0][1]), C.dReal(inert[0][2]), C.dReal(inert[1][3]))
	m.fromC(c)
}

作者:bfosberr    项目:od   
// Build builds a heightfield data set.
func (h Heightfield) Build(data HeightfieldData, heightSamples Matrix,
	width, depth, scale, offset, thickness float64, doWrap bool) {

	numWidthSamp, numDepthSamp := len(heightSamples), 0
	var heightSamplesPtr *C.double
	if numDepthSamp > 0 {
		numWidthSamp = len(heightSamples[0])
		if numWidthSamp > 0 {
			heightSamplesPtr = (*C.double)(&heightSamples[0][0])
		}
	}
	C.dGeomHeightfieldDataBuildDouble(data.c(), heightSamplesPtr, 1,
		C.dReal(width), C.dReal(depth), C.int(numWidthSamp), C.int(numDepthSamp),
		C.dReal(scale), C.dReal(offset), C.dReal(thickness), C.int(btoi(doWrap)))
}

作者:bfosberr    项目:od   
func (g *ContactGeom) toC(c *C.dContactGeom) {
	Vector(g.Pos).toC((*C.dReal)(&c.pos[0]))
	Vector(g.Normal).toC((*C.dReal)(&c.normal[0]))
	c.depth = C.dReal(g.Depth)
	c.g1 = g.G1.c()
	c.g2 = g.G2.c()
	c.side1 = C.int(g.Side1)
	c.side2 = C.int(g.Side2)
}

作者:bfosberr    项目:od   
func (v Vector) convertC(c *C.dReal, toC bool) {
	for i := range v {
		if toC {
			*c = C.dReal(v[i])
		} else {
			v[i] = float64(*c)
		}
		c = (*C.dReal)(unsafe.Pointer(uintptr(unsafe.Pointer(c)) + unsafe.Sizeof(*c)))
	}
}

作者:bfosberr    项目:od   
// SetContactSurfaceLayer sets the depth of the surface layer around all
// geometry objects.
func (w World) SetContactSurfaceLayer(depth float64) {
	C.dWorldSetContactSurfaceLayer(w.c(), C.dReal(depth))
}

作者:bfosberr    项目:od   
// SetContactMaxCorrectingVelocity sets the maximum correcting velocity that
// contacts are allowed to generate.
func (w World) SetContactMaxCorrectingVelocity(overRelaxation float64) {
	C.dWorldSetContactMaxCorrectingVel(w.c(), C.dReal(overRelaxation))
}

作者:krux0    项目:god   
func (m *Mass) SetTrimesh(density Real, g *Geom) {
	C.dMassSetTrimesh((*C.dMass)(m), C.dReal(density), (C.dGeomID)((*C.struct_dxGeom)(g)))
}

作者:bfosberr    项目:od   
// SetCFM sets the constraint force mixing value.
func (w World) SetCFM(cfm float64) {
	C.dWorldSetCFM(w.c(), C.dReal(cfm))
}

作者:bfosberr    项目:od   
// SetGravity sets the gravity vector.
func (w World) SetGravity(grav Vector3) {
	C.dWorldSetGravity(w.c(), C.dReal(grav[0]), C.dReal(grav[1]), C.dReal(grav[2]))
}

作者:bfosberr    项目:od   
// SetAngularDampingThreshold sets the angular damping threshold.
func (w World) SetAngularDampingThreshold(threshold float64) {
	C.dWorldSetAngularDampingThreshold(w.c(), C.dReal(threshold))
}

作者:bfosberr    项目:od   
// SetAutoDisableTime sets the auto disable time.
func (w World) SetAutoDisableTime(time float64) {
	C.dWorldSetAutoDisableTime(w.c(), C.dReal(time))
}

作者:krux0    项目:god   
func (m *Mass) Translate(v Vector3) {
	C.dMassTranslate((*C.dMass)(m), C.dReal(v[0]), C.dReal(v[1]), C.dReal(v[2]))
}

作者:krux0    项目:god   
func (m *Mass) Adjust(newmass Real) {
	C.dMassAdjust((*C.dMass)(m), C.dReal(newmass))
}

作者:krux0    项目:god   
func (m *Mass) SetTrimeshTotal(total_mass Real, g *Geom) {
	C.dMassSetTrimeshTotal((*C.dMass)(m), C.dReal(total_mass), (C.dGeomID)((*C.struct_dxGeom)(g)))
}

作者:bfosberr    项目:od   
// SetAutoDisableLinearThreshold sets the auto disable linear average threshold.
func (w World) SetAutoDisableLinearThreshold(linearThreshold float64) {
	C.dWorldSetAutoDisableLinearThreshold(w.c(), C.dReal(linearThreshold))
}

作者:bfosberr    项目:od   
// SetAutoDisableAngularThreshold sets the auto disable angular average threshold.
func (w World) SetAutoDisableAngularThreshold(angularThreshold float64) {
	C.dWorldSetAutoDisableAngularThreshold(w.c(), C.dReal(angularThreshold))
}

作者:krux0    项目:god   
func (m *Matrix6) Random(absmax Real) {
	C.dMakeRandomMatrix((*C.dReal)(&m[0]), 6, 6, C.dReal(absmax))
}

作者:bfosberr    项目:od   
// SetAngularDamping sets the angular damping scale.
func (w World) SetAngularDamping(scale float64) {
	C.dWorldSetAngularDamping(w.c(), C.dReal(scale))
}

作者:bfosberr    项目:od   
// SetMaxAngularSpeed sets the maximum angular speed.
func (w World) SetMaxAngularSpeed(maxSpeed float64) {
	C.dWorldSetMaxAngularSpeed(w.c(), C.dReal(maxSpeed))
}


问题


面经


文章

微信
公众号

扫码关注公众号