public SingleObjectScene( HomogeneousPoint3D observer, IPolyhedron3D initialObject, int distanceBetweenScreenAndObserver) : base(observer, distanceBetweenScreenAndObserver) { AddObject(initialObject); }
protected void MoveObserverToTransformation(HomogeneousPoint3D point, IPolyhedron3D obj) { Matrix affineMatrix = AffineTransformation.MoveOriginTo(point); obj.Transform(affineMatrix); obj.TransformRotationCenter(affineMatrix); }
public MultipleObjectsScene( HomogeneousPoint3D observer, IPolyhedron3D initialObject, int distanceBetweenScreenAndObserver) : base(observer, distanceBetweenScreenAndObserver) { _objects = new List <IPolyhedron3D>(); AddObject(initialObject); }
private void InitializeMultipleObjectsScene() { IPolyhedron3D polyhedron = PolyhedronBuilder.CreatePolyhedron( _currenPolyhedronType, new HomogeneousPoint3D(0, 0, 0, 1), new HomogeneousPoint3D(0, 0, 0, 1), A); _scene = new MultipleObjectsScene(new HomogeneousPoint3D(0, 0, -600, 1), polyhedron, 400); }
public override void AddObject(IPolyhedron3D obj) { _object = obj; MoveObserverToTransformation(_observerPosition, _object); RotateAroundAxisTransformation(Axis3D.OX, _rotationAngleAroundAxis[Axis3D.OX], _object); RotateAroundAxisTransformation(Axis3D.OY, _rotationAngleAroundAxis[Axis3D.OY], _object); RotateAroundAxisTransformation(Axis3D.OZ, _rotationAngleAroundAxis[Axis3D.OZ], _object); RotateAroundVectorTransformation(_rotationAngleAroundVector, _object); }
public Polygon3D(IList <HomogeneousPoint3D> vertexes, IPolyhedron3D parent) { if (vertexes.Count < _minVertexesCount) { throw new ArgumentException($"{_minVertexesCount} and more vertexes required"); } _parent = parent; _vertexes = vertexes; }
private void MovePolyhedronTo(HomogeneousPoint3D currentCenter, HomogeneousPoint3D needCenter, IPolyhedron3D polyhedron) { var originPoint = new HomogeneousPoint3D( currentCenter.X - needCenter.X, currentCenter.Y - needCenter.Y, currentCenter.Z - needCenter.Z, needCenter.W); Matrix affineMatrix = AffineTransformation.MoveOriginTo(originPoint); polyhedron.Transform(affineMatrix); polyhedron.TransformRotationCenter(affineMatrix); }
public override void AddObject(IPolyhedron3D obj) { _objects.Add(obj); CalculateObjectsPosition(); _compositeObject = new CompositePolyhedron3D( new HomogeneousPoint3D(0, 0, 0, 1), new HomogeneousPoint3D(0, 0, 0, 1), _objects.ToArray(), (0, 0)); _observerPosition = new HomogeneousPoint3D(0, 0, -Radius, 1); MoveObserverToTransformation(_observerPosition, _compositeObject); }
protected void RenderObj( IntPtr renderer, IPolygonDrawer visibleFacetDrawer, IPolygonDrawer notVisibleFacetDrawer, Point screenCenter, IPolyhedron3D obj) { obj.ProjectVertexesToScreen(_distanceBetweenScreenAndObserver, screenCenter); obj.CalculateVisibilityOfFacets(); foreach (var facet in obj.VisibleFacets) { facet.Projection.Draw(renderer, visibleFacetDrawer); } foreach (var facet in obj.NotVisibleFacets) { facet.Projection.Draw(renderer, notVisibleFacetDrawer); } }
public abstract void AddObject(IPolyhedron3D polyhedron);
protected void RotateAroundVectorTransformation(double angle, IPolyhedron3D obj) { Matrix affineMatrix = AffineTransformation.RotateAroundVector(obj.RotationVector, angle); obj.Transform(affineMatrix); }
protected void RotateAroundAxisTransformation(Axis3D axis, double angle, IPolyhedron3D obj) { Matrix affineMatrix = AffineTransformation.RotateAroundAxisAtPoint(axis, obj.RotationCenter, angle); obj.Transform(affineMatrix); }