public static List <Model3d> Query(OctreeNode node, Sphere3d sphere) { //std::vector<Model*> result; List <Model3d> result = new List <Model3d>(); if (IntersectionTest3D.Sphere3dWithAABB3d(sphere, node.m_bounds)) { if (node.m_children == null) { for (int i = 0, size = node.m_models.Count; i < size; ++i) { OBB3d bounds = node.m_models[i].GetOBB(); if (IntersectionTest3D.Sphere3dWithObb3d(sphere, bounds)) { result.Add(node.m_models[i]); } } } else { for (int i = 0; i < 8; ++i) { List <Model3d> child = Query(node.m_children[i], sphere); if (child.Count > 0) { //result.insert(result.end(), child.begin(), child.end()); result.AddRange(child); } } } } return(result); }
public void CreateModel(SettingsSphere settings) { var model = new SceneObject(); Sphere3d sphere = new Sphere3d(settings.Center, settings.Radius, settings.Color, settings.Material); model.AddObject(sphere); Scene.AddModel(model); }
public Model(GraphicsBuffer elementBuffer, ElementType elementType, Sphere3d bounds) { if (elementBuffer == null) throw new ArgumentNullException("elementBuffer"); this.elementBuffer = elementBuffer; this.elementType = elementType; this.bounds = bounds; bones = new ModelBoneCollection(this); meshes = new ModelMeshCollection(this); }
public Model(GraphicsBuffer elementBuffer, ElementType elementType, Sphere3d bounds) { if (elementBuffer == null) { throw new ArgumentNullException("elementBuffer"); } this.elementBuffer = elementBuffer; this.elementType = elementType; this.bounds = bounds; bones = new ModelBoneCollection(this); meshes = new ModelMeshCollection(this); }
public ModelMesh(Sphere3d bounds, ModelBone bone, IEnumerable <ModelPart> parts) : this() { if (bone != null && bone.model != null) { bone.model.Meshes.Add(this); } Bounds = bounds; Bone = bone; foreach (var item in parts) { Parts.Add(item); } }
public void Collides_Ray3d() { // Arrange var s0 = new Sphere3d(new Vector3d(-2, 0, 0), 3); var r0 = new Ray3d(new Vector3d(2, 0, 0), new Vector3d(-1, 0, 0)); // Act var c0 = s0.Collides(r0); // Assert Assert.AreEqual(new Vector3d(1, 0, 0), c0.HitPoint); Assert.AreEqual(new Vector3d(1, 0, 0), c0.Normal); Assert.AreEqual(s0, c0.Object0); Assert.AreEqual(r0, c0.Object1); Assert.AreEqual(0, c0.PenetrationDepth); }
public List <Model3d> Query(Sphere3d sphere) { if (m_octree != null) { // :: lets the compiler know to look outside class scope return(Octree3d.Query(m_octree, sphere)); } List <Model3d> result = new List <Model3d>(); for (int i = 0, size = m_modleList.Count; i < size; ++i) { OBB3d bounds = m_modleList[i].GetOBB(); if (IntersectionTest3D.Sphere3dWithObb3d(sphere, bounds)) { result.Add(m_modleList[i]); } } return(result); }
public void Collides_Sphere3d() { // Arrange var s0 = new Sphere3d(new Vector3d(-2, 0, 0), 3); var s1 = new Sphere3d(new Vector3d(2, 0, 0), 3); // Act var c0 = s0.Collides(s1); var c1 = s1.Collides(s0); // Assert Assert.AreEqual(new Vector3d(1, 0, 0), c0.HitPoint); Assert.AreEqual(new Vector3d(-1, 0, 0), c0.Normal); Assert.AreEqual(s0, c0.Object0); Assert.AreEqual(s1, c0.Object1); Assert.AreEqual(2, c0.PenetrationDepth); Assert.AreEqual(new Vector3d(-1, 0, 0), c1.HitPoint); Assert.AreEqual(new Vector3d(1, 0, 0), c1.Normal); Assert.AreEqual(s1, c1.Object0); Assert.AreEqual(s0, c1.Object1); Assert.AreEqual(2, c1.PenetrationDepth); }
public void CodeSphere3d(ref Sphere3d v) { CodeV3d(ref v.Center); CodeDouble(ref v.Radius); }
//int modelMatrixUniformIndex; public SceneSphere(IRenderableModel model, Sphere3d sphere) { this.model = model; this.Sphere = sphere; UpdatePosition(); }
public void Add(RenderableModel model, Sphere3d sphere) { SceneSphere sceneSphere = new SceneSphere(model, sphere); Renderables.Add(sceneSphere); }
/// <summary></summary> public FilterInsideSphere3d(Sphere3d sphere) { m_sphere = sphere; m_radiusSquared = sphere.RadiusSquared; }
public void CodeSphere3d(ref Sphere3d v) { throw new NotImplementedException(); }
public void CodeSphere3d(ref Sphere3d v) { AddValue(v.ToString()); }
public ProceduralParameters StartSphere(Sphere3d sphere) { return(StartSphere(sphere.Radius).SetCentre(sphere.Position)); }
public ModelMesh(Sphere3d bounds, ModelBone bone, params ModelPart[] parts) : this(bounds, bone, (IEnumerable <ModelPart>)parts) { }
public ProceduralParameters StartSphere(Sphere3d sphere) { return StartSphere(sphere.Radius).SetCentre(sphere.Position); }