Mesh Class
A triangle mesh is a type of polygon mesh in computer graphics. It comprises a set of triangles (typically in three dimensions) that are connected by their common edges or corners.
Depending on the types of vertices and triangles, it can assume different configurations, see table below.
Triangles type / Vertices type | Point3D | PointRGB |
IndexTriangle | Plain1 | MulticolorPlain |
SmoothTriangle | Smooth1 | MulticolorSmooth |
ColorTriangle | ColorPlain | |
ColorSmoothTriangle | ColorSmooth | |
RichTriangle | RichPlain | |
RichSmoothTriangle | RichSmooth |
1 Allows transparency to be used
Public Class Mesh
Inherits Entity
Implements IFace, _
IFaceSelectable, _
ISelectableSubItems
This language is not supported or no code example is available.
public class Mesh : Entity,
IFace,
IFaceSelectable,
ISelectableSubItems
This language is not supported or no code example is available.
Name | Description | |
---|---|---|
Mesh(Mesh) | ||
Mesh() | Empty constructor. For internal use only. Mesh nature is set to Plain. | |
Mesh(IList<Point3D>, IList<IndexTriangle>) | Vertices and triangles constructor. | |
Mesh(SerializationInfo, StreamingContext) | ||
Mesh(int, int, natureType) | Vertices and triangles sizes constructor. | |
Mesh(natureType) | Mesh nature constructor. | |
Mesh(natureType, edgeStyleType) | Mesh nature and edge style constructor. |
Name | Description | |
---|---|---|
AutodeskProperties | Gets or sets the Autodesk common properties. (inherited from Entity). | |
BoxMax | Gets the maximum 3D extent of the entity. (inherited from Entity). | |
BoxMin | Gets the minimum 3D extent of the entity. (inherited from Entity). | |
BoxSize | Gets the 3D extent of the entity. (inherited from Entity). | |
Color | Gets or sets the entity color. (inherited from Entity). | |
ColorMethod | Gets or sets the entity color source. (inherited from Entity). | |
Compiling | Tells if the entity is being compiled. (inherited from Entity). | |
EdgeStyle | Gets or sets the edge style. This setting comes into play during Mesh regeneration only. | |
Edges | Direct access to Mesh edges. | |
EntityData | Gets or sets the entity custom data. If the type implements ICloneable it will be cloned when the Entity is cloned. (inherited from Entity). | |
Faces | The collection of the (sorted) faces for selection. | |
GroupIndex | Gets or sets the entity group index. (inherited from Entity). | |
IsClosed | Tells if a mesh is closed. | |
LayerName | Gets or sets the name of the referenced Layer. (inherited from Entity). | |
LightWeight | ||
LineTypeMethod | Gets or sets the entity line type source. (inherited from Entity). | |
LineTypeName | Gets or sets the line type name of the Environment.LineTypes collection. In use only if the LineTypeMethod is byEntity. (inherited from Entity). | |
LineTypeScale | Gets or sets the line type scale. (inherited from Entity). | |
LineWeight | Gets or sets the entity line weight. (inherited from Entity). | |
LineWeightMethod | Gets or sets the entity line weight source. (inherited from Entity). | |
MaterialName | Gets or sets the entity material name. (inherited from Entity). | |
MeshNature | Gets mesh nature. | |
NormalAveragingMode | Gets or sets the normal averaging prevMode. | |
Normals | Gets or sets the mesh normals. | |
OrientedBounding | A bounding volume that can fit the entity in a different orientation than AABB. It can be an OrientedBoundingBox or an OrientedBoundingRect(for planar entities). UpdateOrientedBoundingBox (inherited from Entity). | |
RegenMode | Gets or sets the entity regeneration mode. | |
Selectable | Gets or sets the value that tells if the top-level item can be selected. (inherited from Entity). | |
Selected | Gets or sets the entity selection status. (inherited from Entity). | |
SelectionMode | Gets or sets the selection mode. | |
SmoothingAngle | Gets or sets the angular value (in radians) used by normal averaging and sharp edges calculation. | |
TextureCoords | Gets or sets mesh texture coordinates. | |
Triangles | Gets or sets the mesh triangles. | |
Vertices | Gets or sets mesh' 3D vertices. | |
Visible | Gets or sets the entity visibility status for the top-level. (inherited from Entity). | |
entityNature | Gets or sets the nature of the entity. (inherited from Entity). |
Name | Description | |
---|---|---|
AddVerticesToXElement(XElement) | For internal use only. (inherited from Entity). | |
AllVerticesInFrustum(FrustumParams) | (inherited from Entity). | |
AllVerticesInScreenPolygon(ScreenPolygonParams) | Tells if an entity is fully contained inside a polygon defined in screen coordinates. (inherited from Entity). | |
Animate(int) | Gives a chance to derived classes to change the entity position/rotation at each timer tick. (inherited from Entity). | |
ApplyMaterial(string, textureMappingType, double, double) | Maps the specified material to this mesh. Before using this method you need to define a material and add it to the Model.Materials collection. | |
ApplyMaterial(string, textureMappingType, double, double, Point3D, Point3D) | Maps the specified material to this mesh. Before using this method you need to define a material and add it to the Model.Materials collection. | |
ApplyTextureMapping(TextureMappingData) | Maps the specified material to this mesh using a custom bounding box. Before using this method you need to define a material and add it to the Model.Materials collection. | |
ApplyTextureMapping(textureMappingType, double, double) | Maps the specified material to this mesh. Before using this method you need to define a material and add it to the Model.Materials collection. | |
ApplyTextureMapping(textureMappingType, double, double, Point3D, Point3D) | Maps the specified material to this mesh using a custom bounding box. Before using this method you need to define a material and add it to the Model.Materials collection. | |
ApplyTextureMapping(textureMappingType, double, double, Point3D, Point3D, Transformation) | Maps the specified material to this mesh using a custom bounding box. Before using this method you need to define a material and add it to the Model.Materials collection. | |
BuildOctree(int) | Builds octree's data. | |
CheckIsSmallArray(int) | Ensures that the IsSmall array is big enough to hold data for the specified number of viewports. (inherited from Entity). | |
ClearFacesSelection(Stack<BlockReference>) | Clears the faces selection status for a specific instance. | |
ClearFacesSelectionForAllInstances() | Clears the faces selection status for all instances. | |
ClearOctree() | Clears octree's data. | |
ClearSelectability(Stack<BlockReference>) | Clear the entity selectability status for the defined nested instance. (inherited from Entity). | |
ClearSelectabilityForAllInstances() | Clears the selectability status for all instances. (inherited from Entity). | |
ClearSelectionForAllInstances() | Clears the selection status for all instances. (inherited from Entity). | |
ClearVisibility(Stack<BlockReference>) | Clear the entity visibility status for the defined nested instance. (inherited from Entity). | |
ClearVisibilityForAllInstances() | Clears the visibility status for all instances. (inherited from Entity). | |
Clone() | Creates a deep copy of this mesh entity. | |
CombineBoundingBox(Transformation, Point3D, Point3D) | Combines the entity's bounding box with the given bounding box. (inherited from Entity). | |
Compile(CompileParams) | Compiles the graphic representation of this entity. | |
CompileEdges(double, CompileParams) | Compiles the graphics data for the edges. | |
CompileSelected(CompileParams) | Compiles the graphics data for the selection. | |
CompileSelectedFace(RenderContextBase, FaceElement) | ||
CompileWire(CompileParams) | Compiles the graphics representation of wireframe entities. (inherited from Entity). | |
ComputeBoundingBox(TraversalParams, out Point3D, out Point3D) | Computes the entity's bounding box. (inherited from Entity). | |
ComputeBoundingBox(TraversalParams, IList<Point3D>, out Point3D, out Point3D) | Computes the entity's bounding box. (inherited from Entity). | |
ComputeBoundingBox(TraversalParams, float[], int, out Point3D, out Point3D) | (inherited from Entity). | |
ComputeEdges() | Forces mesh edges computation according to the EdgeStyle settings. | |
ComputeOffsetOnCameraAxes(OffsetOnCameraAxesParams) | Computes the intersection of the lines passing from the vertices and oriented like the frustum planes with the X and Y axes of the camera. (inherited from Entity). | |
ComputeOffsetOnCameraAxes(OffsetOnCameraAxesParams, IList<Point3D>, int) | (inherited from Entity). | |
ComputeOffsetOnCameraAxes(Transformation, float[], int, Point2D, Point2D, Point2D, Point2D, int) | (inherited from Entity). | |
ConvertToFemMesh(Material, bool) | Convert this mesh to a 2D FemMesh object. | |
ConvertToSolid() | Converts this mesh to a Solid object. | |
ConvertToSolid<T>() | Converts this mesh to a Solid object. | |
ConvertToSurrogate() | Converts the entity to its surrogate, for serialization purpose. | |
CopyAttributes(Entity) | Copies the following attributes to this entity: Color, ColorMethod, LineWeight, LineTypePattern, LineTypeMethod, LineWeight, LineWeightMethod, LayerName and MaterialName. (inherited from Entity). | |
CopyAttributesFast(Entity) | Copies the following attributes to this entity: Visible, InstanceVisibilityInfo, Color, ColorMethod, LayerName and MaterialName attributes. (inherited from Entity). | |
CreateArrow(Point3D, Vector3D, double, double, double, double, int, natureType, edgeStyleType) | Creates a 3D arrow primitive. | |
CreateArrow(double, double, double, double, int, natureType) | Creates a 3D arrow primitive. | |
CreateArrow(double, double, double, double, int, natureType, edgeStyleType) | Creates a 3D arrow primitive. | |
CreateArrow<T>(Point3D, Vector3D, double, double, double, double, int, natureType, edgeStyleType) | Creates a 3D arrow primitive. | |
CreateArrow<T>(double, double, double, double, int, natureType) | Creates a 3D arrow primitive. | |
CreateArrow<T>(double, double, double, double, int, natureType, edgeStyleType) | Creates a 3D arrow primitive. | |
CreateBox(double, double, double) | Creates a Box primitive. | |
CreateBox(double, double, double, natureType) | Creates a Box primitive. | |
CreateBox(double, double, double, natureType, edgeStyleType) | Creates a Box primitive. | |
CreateBox<T>(double, double, double) | Creates a Box primitive. | |
CreateBox<T>(double, double, double, natureType) | Creates a Box primitive. | |
CreateBox<T>(double, double, double, natureType, edgeStyleType) | Creates a Box primitive. | |
CreateCone(double, double, Point3D, Point3D, int) | Creates a Cone primitive. | |
CreateCone(double, double, Point3D, Point3D, int, natureType) | Creates a Cone primitive. | |
CreateCone(double, double, Point3D, Point3D, int, natureType, edgeStyleType) | Creates a Cone primitive. | |
CreateCone(double, double, double, int) | Creates a Cone primitive. | |
CreateCone(double, double, double, int, natureType) | Creates a Cone primitive. | |
CreateCone(double, double, double, int, natureType, edgeStyleType) | Creates a Cone primitive. | |
CreateCone<T>(double, double, Point3D, Point3D, int) | Creates a Cone primitive. | |
CreateCone<T>(double, double, Point3D, Point3D, int, natureType) | Creates a Cone primitive. | |
CreateCone<T>(double, double, Point3D, Point3D, int, natureType, edgeStyleType) | Creates a Cone primitive. | |
CreateCone<T>(double, double, double, int) | Creates a Cone primitive. | |
CreateCone<T>(double, double, double, int, natureType) | Creates a Cone primitive. | |
CreateCone<T>(double, double, double, int, natureType, edgeStyleType) | Creates a Cone primitive. | |
CreateCylinder(double, Point3D, Point3D, int) | Creates a Cylinder primitive. | |
CreateCylinder(double, Point3D, Point3D, int, natureType) | Creates a Cylinder primitive. | |
CreateCylinder(double, Point3D, Point3D, int, natureType, edgeStyleType) | Creates a Cylinder primitive. | |
CreateCylinder(double, double, int) | Creates a Cylinder primitive. | |
CreateCylinder(double, double, int, natureType) | Creates a Cylinder primitive. | |
CreateCylinder(double, double, int, natureType, edgeStyleType) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, Point3D, Point3D, int) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, Point3D, Point3D, int, natureType) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, Point3D, Point3D, int, natureType, edgeStyleType) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, double, int) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, double, int, natureType) | Creates a Cylinder primitive. | |
CreateCylinder<T>(double, double, int, natureType, edgeStyleType) | Creates a Cylinder primitive. | |
CreatePlanar(ICurve, IList<ICurve>, double, natureType) | Obsolete. Triangulates the specified 3D region. | |
CreatePlanar(ICurve, double, natureType) | Obsolete. Triangulates the specified 3D region. | |
CreatePlanar(IList<Point3D>, IList<IList<Point3D>>, natureType) | Triangulates the specified 3D region. | |
CreatePlanar(IList<Point3D>, natureType) | Triangulates the specified 3D region. | |
CreatePlanar(Plane, IList<Point2D>, IList<IList<Point2D>>, natureType) | Triangulates the specified 2D region. | |
CreatePlanar(Plane, IList<Point2D>, natureType) | Triangulates the specified 2D region. | |
CreatePlanar<T>(ICurve, IList<ICurve>, double, natureType) | Obsolete. Triangulates the specified 3D region. | |
CreatePlanar<T>(ICurve, double, natureType) | Obsolete. Triangulates the specified 3D region. | |
CreatePlanar<T>(IList<Point3D>, IList<IList<Point3D>>, natureType) | Triangulates the specified 3D region. | |
CreatePlanar<T>(IList<Point3D>, natureType) | Triangulates the specified 3D region. | |
CreatePlanar<T>(Plane, IList<Point2D>, IList<IList<Point2D>>, natureType) | Triangulates the specified 2D region. | |
CreatePlanar<T>(Plane, IList<Point2D>, natureType) | Triangulates the specified 2D region. | |
CreateSphere(double, int, int) | Creates a Sphere primitive. | |
CreateSphere(double, int, int, natureType) | Creates a Sphere primitive. | |
CreateSphere<T>(double, int, int) | Creates a Sphere primitive. | |
CreateSphere<T>(double, int, int, natureType) | Creates a Sphere primitive. | |
CreateSpring(double, double, int, int, double, double, bool) | Creates a Spring primitive. | |
CreateSpring(double, double, int, int, double, double, bool, bool, natureType) | Creates a Spring primitive. | |
CreateSpring<T>(double, double, int, int, double, double, bool) | Creates a Spring primitive. | |
CreateSpring<T>(double, double, int, int, double, double, bool, bool, natureType) | Creates a Spring primitive. | |
CreateTorus(double, double, int, int) | Creates a Torus primitive. | |
CreateTorus(double, double, int, int, natureType) | Creates a Torus primitive. | |
CreateTorus<T>(double, double, int, int) | Creates a Torus primitive. | |
CreateTorus<T>(double, double, int, int, natureType) | Creates a Torus primitive. | |
CutBy(Plane) | Cuts the part of the mesh on the positive side of a plane. | |
CutBy(Plane, bool) | Cuts the part of the mesh on the positive side of a plane. | |
Dispose() | Cleans up graphics resources, like display lists, textures, etc. | |
Draw(DrawParams) | Draws the entity. | |
DrawDirection(DrawDirectionParams) | Draws a small arrow to show the entity direction if DrawCurveDirection is true. (inherited from Entity). | |
DrawEdges(DrawParams) | Draws the entity's edges. | |
DrawEntity(RenderContextBase, object) | ||
DrawFace(RenderContextBase, object) | ||
DrawFast(DrawParams) | Draws the entity in fast inaccurate transparency mode. (inherited from Entity). | |
DrawFlat(DrawParams) | Draws entity in displayType.Flat DisplayMode. | |
DrawFlatFast(DrawParams) | Draws the entity in flat and fast inaccurate transparency mode. (inherited from Entity). | |
DrawFlatSelected(DrawParams) | Draws entity selected in displayType.Flat DisplayMode. (inherited from Entity). | |
DrawForSelection(GfxDrawForSelectionParams) | Draws the entity without specifing any color. | |
DrawForSelectionEdges(GfxDrawForSelectionParams) | Draws the entity edges in false-colors (for some kinds of entities only). (inherited from Entity). | |
DrawForSelectionFaces(GfxDrawForSelectionParams) | Draws the entity faces in false-colors (for some kinds of entities only). | |
DrawForSelectionVertices(GfxDrawForSelectionParams) | Draws the entity vertices in false-colors (for some kinds of entities only). (inherited from Entity). | |
DrawForSelectionWireframe(GfxDrawForSelectionParams) | Draws entity as wires without specifing any color. | |
DrawForShadow(RenderParams) | Draws the entity planar shadow. | |
DrawHiddenLines(DrawParams) | Draw the entity in the displayType.HiddenLines display mode. | |
DrawHiddenLinesFast(DrawParams) | Draw the entity in the displayType.HiddenLines display mode in fast inaccurate transparency mode. (inherited from Entity). | |
DrawHiddenLinesMaterial(RenderParams) | ||
DrawHiddenLinesMaterialFast(RenderParams) | (inherited from Entity). | |
DrawIsocurves(DrawParams) | Draws the entity iso curves. For Mesh entities this method draws internal wires. | |
DrawIsocurvesForFlat(DrawParams) | Draws the isocurves in Flat display mode. (inherited from Entity). | |
DrawNormals(DrawParams) | Draws entity's normal vectors. | |
DrawOnScreen(DrawOnScreenParams) | Draws extra things on screen, like the vertex indices (if Viewport.ShowVertexIndices is true). (inherited from Entity). | |
DrawOnScreen(DrawOnScreenParams, int) | Draws extra things on screen, like the vertex indices (if Viewport.ShowVertexIndices is true). (inherited from Entity). | |
DrawOnScreenWireframe(DrawOnScreenWireframeParams) | Draws extra things on screen, like the vertex Numbers (if Viewport.ShowVertexIndices is true) in wireframe display mode. (inherited from Entity). | |
DrawOnScreenWireframe(DrawOnScreenWireframeParams, int) | Draws extra things on screen, like the vertex Numbers (if Viewport.ShowVertexIndices is true) in wireframe dispaly mode. (inherited from Entity). | |
DrawSelected(DrawParams) | Draws entity selected. | |
DrawSelectedVertices(DrawParams) | Draws the entity selected vertices. (inherited from Entity). | |
DrawSilhouettes(DrawSilhouettesParams) | Draws Silhouettes. | |
DrawVertices(DrawParams) | Draws entity's vertices. (inherited from Entity). | |
DrawWire(DrawParams) | Draws a wireframe entity, resolving the LineTypeName for LineTypeMethod colorMethodType.byParent. (inherited from Entity). | |
DrawWireEntity(RenderContextBase, object) | Draws the Wireframe entity. (inherited from Entity). | |
DrawWireframe(DrawParams) | Draws entity as wires. | |
DrawWireframeSelected(DrawParams) | Draws entity as selected wires. (inherited from Entity). | |
DrawWithPattern(RenderContextBase, object) | (inherited from Entity). | |
Dump(linearUnitsType, massUnitsType, LayerKeyedCollection, MaterialKeyedCollection, BlockKeyedCollection) | Returns a description of this entity. | |
Equals(Object) | Determines whether the specified object is equal to the current object. (inherited from Object). | |
EstimateBoundingBox(BlockKeyedCollection, LayerKeyedCollection) | Returns a small set of points that gives an idea of the entity bounding box. | |
EvaluateIntersectEdges(FrustumParams) | Tells if must evaluate the intersection of the edges with the frustum. | |
EvaluateIntersectTriangles(FrustumParams) | Tells if must evaluate the intersection of the triangles with the frustum. | |
ExtrudePlanar(Vector3D) | Extrudes a quasi-planar mesh. | |
ExtrudePlanar(double, double, double) | Extrudes a quasi-planar mesh. | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (inherited from Object). | |
FindClosestTriangle(Transformation, Segment3D) | Returns a list of triangles hit by the provided segment. | |
FixNormals() | Makes triangles winding order uniform. | |
FlipNormal() | ||
FlipOutward() | Flips the mesh normals outward. | |
FromTriangles(Point3D[]) | Generates a smooth Mesh from a list of triangles. | |
FrustumEdgesTriangleIntersection(Segment3D[], Point3D, Point3D, Point3D) | (inherited from Entity). | |
GetAllVertices(TraversalParams, out IList<Point3D>) | Gets tesselation vertices of the entity. (inherited from Entity). | |
GetArea(out Point3D) | ||
GetClosestMainAxis(Vector3D) | (inherited from Entity). | |
GetFaceSelection(int, Stack<BlockReference>) | Gets a face selection status. | |
GetFaceSelection(int, int, Stack<BlockReference>) | ||
GetFaceTriangles(int, double) | Gets the triangles adjacent to the given triangle. | |
GetHashCode | Serves as the default hash function. (inherited from Object). | |
GetMass(Material, linearUnitsType, massUnitsType, out double) | ||
GetNormalLength() | Gets the entity normal length. (inherited from Entity). | |
GetObjectData(SerializationInfo, StreamingContext) | Populates a SerializationInfo instance with the data needed to serialize the target object. | |
GetOffsetDistance(Vector3D, Vector3D, double) | Computes the offset distance for the extrude with draft angle methods. (inherited from Entity). | |
GetPolygonMeshes() | Gets a number of meshes representing this object. | |
GetSelectability(Stack<BlockReference>) | Gets the entity selectability status. (inherited from Entity). | |
GetSelection(Stack<BlockReference>) | Gets the entity selection status. (inherited from Entity). | |
GetType | Gets the Type of the current instance. (inherited from Object). | |
GetVisibility(Stack<BlockReference>) | Gets the entity visibility status. (inherited from Entity). | |
GetVolume(out Point3D) | ||
GetXAttributes(bool) | For internal use only. (inherited from Entity). | |
GetXElement(bool) | For internal use only. | |
InitGraphicsData() | Initialize the graphics data. | |
InsideFrustumPoint(PlaneEquation[], Transformation, IList<Point3D>, int) | (inherited from Entity). | |
InsideOrCrossingFrustum(FrustumParams) | ||
InsideOrCrossingFrustumInternal(PlaneEquation[], Transformation, IList<Point3D>, int, int) | (inherited from Entity). | |
InsideOrCrossingScreenPolygon(ScreenPolygonParams) | ||
InsideOrCrossingScreenPolygonInternal(ScreenPolygonParams, IList<Point3D>, int, int) | (inherited from Entity). | |
InsideOrCrossingScreenPolygonPoint(ScreenPolygonParams, IList<Point3D>, int) | (inherited from Entity). | |
Intersects(Entity, bool, bool, Transformation, Transformation, out List<Entity>, out string) | Checks if two entity intersect geometrically (inherited from Entity). | |
Intersects2D(Entity, bool, bool, Transformation, Transformation, out List<Entity>) | Checks if two 2D entity intersect geometrically on Plane XY (inherited from Entity). | |
IsAnyFaceSelected() | Tells if there is a selected face. | |
IsAnyInstanceSelectable() | Tells if there is at least an instance selectable. (inherited from Entity). | |
IsAnyInstanceSelected() | Tells if there is at least an instance selected. (inherited from Entity). | |
IsAnyInstanceVisible() | Tells if there is at least an instance visible. (inherited from Entity). | |
IsCrossing(FrustumParams) | Tells if the entity is inside or crossing the given planes and edges. (inherited from Entity). | |
IsCrossingScreenPolygon(ScreenPolygonParams) | Tells if an entity is fully or partially contained inside a polygon defined in screen coordinates. (inherited from Entity). | |
IsInFrustum(FrustumParams) | Tells if the entity is inside the frustum planes. (inherited from Entity). | |
IsInFrustum(FrustumParams, Point3D, double) | Tells if the sphere surrounding the entity is inside the frustum planes. (inherited from Entity). | |
IsPointInside(Point3D) | Checks if the specified point is inside the 3D mesh. | |
IsSelected(Stack<BlockReference>) | Obsolete. Tells if the instance referred by the stack of parents is selected. (inherited from Entity). | |
IsSmall(IsSmallParams) | Checks if an entity is small and can be skipped during the drawing. (inherited from Entity). | |
IsSmall(int) | Tells if the entity screen size is classified as small/>. (inherited from Entity). | |
IsValid() | Returns true if all the entity fields contain reasonable information. | |
IsVisible(Stack<BlockReference>, LayerKeyedCollection, attributeReferenceVisibilityType) | Check if the entity is visible. (inherited from Entity). | |
IsVisibleAndInFrustum(Stack<BlockReference>, LayerKeyedCollection, attributeReferenceVisibilityType) | Check if the entity is visible. (inherited from Entity). | |
MemberwiseClone | Creates a shallow copy of the current Object. (inherited from Object). | |
MergeWith(Quad, bool) | Merges the mesh with a Quad entity that shares an edge with the mesh. | |
MergeWith(Triangle, bool) | Merges the mesh with a Quad entity that shares an edge with the mesh. | |
MergeWith(Mesh, bool, bool) | Merges two compatible Mesh objects. | |
MergeWith(Quad) | Merges the mesh with a Quad entity that shares an edge with the mesh. | |
MergeWith(Triangle) | Merges the mesh with a Quad entity that shares an edge with the mesh. | |
PropagateAttributes(Entity, Entity, bool) | Propagates the attributes to the entity passed as parameter. (inherited from Entity). | |
Regen(RegenParams) | This method is used for several purposes. For example in arcs and circles is used to generate the curve's linear approximation, in meshes to compute normals and edges and in Nurbs surfaces to generate the triangulation. | |
RegenNoChanges(double) | Computes an array of vertices according to the desired chordal error, without changing the entity's Vertices and RegenMode. (inherited from Entity). | |
RemoveMaterial() | Remove the material and the texture mapping. | |
RemoveTextureMapping() | Remove the texture mapping. | |
Render(RenderParams) | Renders the entity. | |
RenderFast(RenderParams) | Renders the entity in fast inaccurate transparency mode. (inherited from Entity). | |
ResetIsSmallArray() | Resets the array of IsSmall flags. (inherited from Entity). | |
ResetSelectionMode() | Resets the SelectionMode to selectionFilterType.Entity if there are no other selected inner elements. | |
RevolvePlanar(double, double, Vector3D, Point3D, int, natureType) | Revolves a quasi-planar mesh. | |
Rotate(double, Vector3D, Point3D) | Rotates the entity around an arbitrary axis by the specified angle. (inherited from Entity). | |
Rotate(double, Point3D, Point3D) | Rotates the entity around an arbitray axis by the specified angle. (inherited from Entity). | |
Rotate(double, Vector3D) | Rotates the entity around an arbitray axis by the specified angle. (inherited from Entity). | |
Scale(Point3D, double, double, double) | Scales the entity of the specified scale factor. (inherited from Entity). | |
Scale(Point3D, double) | Scales the entity of the specified scale factor. (inherited from Entity). | |
Scale(Vector3D) | Scales the entity of the specified scale factor. (inherited from Entity). | |
Scale(double) | Scales the entity of the specified scale factor. (inherited from Entity). | |
Scale(double, double, double) | Scales the entity of the specified scale factor. (inherited from Entity). | |
Section(Plane, double) | Computes the contours resulting from the intersection of the face and the given plane. | |
Section(Plane, double, LinkedList<SharedEdge>[]) | Computes the contours resulting from the intersection of the face and the given plane. | |
Section(Plane, double, out SharedEdge[][]) | Computes the contours resulting from the intersection of the face and the given plane. | |
Section(PlaneEquation, LinkedList<SharedEdge>[]) | Computes the contours resulting from the intersection of the Mesh and the given plane. | |
Section(PlaneEquation, out SharedEdge[][]) | Computes the contours resulting from the intersection of the Mesh and the given plane. | |
SelectFace(int, bool, Stack<BlockReference>) | Obsolete. Selects the face of the instance identified by the parents stack. | |
SelectedInternal() | Tells if the entity has internal parts selected | |
SetEntityColorForFace(DrawParams, Color) | Sets the entity color or material depending on the color mode. (inherited from Entity). | |
SetEntityColorForSelection(DrawParams) | Sets the entity color or material depending on the color mode. (inherited from Entity). | |
SetFaceSelection(int, bool, Stack<BlockReference>) | Sets the selection status of a face. | |
SetFaceSelection(int, int, bool, Stack<BlockReference>) | ||
SetLineWeight(RenderContextBase, float) | Line weight changer. (inherited from Entity). | |
SetLineWeightForEdges(DrawEdgesParams) | ||
SetLineWeightForSilhouettes(DrawSilhouettesParams) | ||
SetSelectability(bool, Stack<BlockReference>) | Sets the entity selectability status. (inherited from Entity). | |
SetSelection(bool, Stack<BlockReference>) | Sets the entity selection status. (inherited from Entity). | |
SetSelectionColorForSelection(DrawParams) | Sets the selection color or material depending on the color mode. (inherited from Entity). | |
SetShader(DrawParams) | Sets a Shader before drawing the entity. | |
SetVisibility(bool, Stack<BlockReference>) | Sets the entity visibility status. (inherited from Entity). | |
SplitBy(Plane, bool, out Mesh[]) | Splits this Mesh object by plane. | |
SplitBy(Plane, out Mesh[]) | Splits this Mesh object by plane. | |
SplitDisjoint() | Divides into separate objects meshes that do not connect, but are still one object. | |
SubdivideBy(Plane) | Subdivides the mesh by a plane. | |
ThroughTriangle(FrustumParams) | ||
ThroughTriangleQuad(FrustumParams, IList<Point3D>) | Tells if the quad defined by the vertices is inside the selection area defined by the edge list. (inherited from Entity). | |
ThroughTriangleScreenPolygon(ScreenPolygonParams) | ||
ThroughTriangleScreenPolygonQuad(IList<Point3D>, ScreenPolygonParams) | Tells if the quad defined by the vertices is inside the selection area defined by the screen polygon. (inherited from Entity). | |
ToString | Returns a string that represents the current object. (inherited from Object). | |
TransformAllVertices(Transformation, bool, bool) | (inherited from Entity). | |
TransformBy(Transformation) | Transforms all the entity's vertices by the specified transformation. | |
Translate(double, double, double) | Translates the entity. (inherited from Entity). | |
Translate(Vector3D) | Translates the entity. (inherited from Entity). | |
UpdateBoundingBox(TraversalParams) | Updates the entity's bounding box. (inherited from Entity). | |
UpdateBoundingBoxSphere() | (inherited from Entity). | |
UpdateNormals() | Refreshes triangles normals. | |
UpdateOrientedBoundingBox(TraversalParams) | Updates the entity's oriented bounding box or build it if not present. (inherited from Entity). | |
UpdateOrientedBoundingBox(TraversalParams, bool) | Updates the entity's oriented bounding box or build it if not present. (inherited from Entity). | |
Weld() | Removes duplicated vertices and degenerated triangles in the Mesh. | |
Weld(double) | Removes duplicated vertices and degenerated triangles in the Mesh with a given tolerance. | |
WriteObjAsLines(ref int, TextWriter, ref int, ref int, ref int, TextWriter, LayerKeyedCollection, string, MaterialKeyedCollection, double, double, BlockKeyedCollection) | Write in Obj file format as set of lines connecting vertices. (inherited from Entity). | |
WriteUsemtl(int, TextWriter, TextWriter, LayerKeyedCollection) | (inherited from Entity). | |
WriteUsemtl(string, TextWriter) | (inherited from Entity). |
Name | Description | |
---|---|---|
VisibleChanged | Occurs when the Visible changes. (inherited from Entity). |
Name | Description | |
---|---|---|
FaceCollection | Class that represents a collection of FaceElement objects. | |
FaceElement | The face element. |
Name | Description | |
---|---|---|
edgeStyleType | Mesh edge style type. | |
natureType | Mesh nature type. | |
normalAveragingType | Mesh normal averaging type. |
Name | Description | |
---|---|---|
_localOB | (inherited from Entity). | |
drawData | Default graphics data. (inherited from Entity). | |
drawEdgesData | ||
drawSelectedData |
The following code samples demonstrate how to use the different mesh natures.
using System; using System.Collections.Generic; using System.Drawing; using devDept.Eyeshot; using devDept.Eyeshot.Entities; using devDept.Geometry; namespace MeshSamples { internal class Mesh { private static int rows = 8; private static int cols = 8; private static double scale = 4; public static void Plain(Model model) { List<Point3D> vertices = new List<Point3D>(rows * cols); Mesh surface = new Mesh(); surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged; for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; vertices.Add(new Point3D(x, y, f)); } List<IndexTriangle> triangles = new List<IndexTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { triangles.Add(new IndexTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)); triangles.Add(new IndexTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface, 0, Color.Green); } public static void ColoredPlain(Model model) { List<Point3D> vertices = new List<Point3D>(rows*cols); Mesh surface = new Mesh(); for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i/5.0 - 2; double y = -j/5.0 - 2; double f = 0; double den = Math.Sqrt(x*x + y*y); if (den != 0) f = scale*Math.Sin(Math.Sqrt(x*x + y*y))/den; vertices.Add(new Point3D(x, y, f)); } List<ColorTriangle> triangles = new List<ColorTriangle>((rows - 1)*(cols - 1)*2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { // generates a random color int red = (int) (255 - i*100); int green = (int) (255 - j*50); int blue = 127; // clamps color values lat 0-255 Utility.LimitRange<int>(0, ref red, 255); Utility.LimitRange<int>(0, ref green, 255); Utility.LimitRange<int>(0, ref blue, 255); triangles.Add(new ColorTriangle(i + j*cols, i + j*cols + 1, i + (j + 1)*cols + 1, (byte) red, (byte) green, (byte) blue)); triangles.Add(new ColorTriangle(i + j*cols, i + (j + 1)*cols + 1, i + (j + 1)*cols, (byte) red, (byte) green, (byte) blue)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface, 0); } public static void MulticolorPlain(Model model) { List<PointRGB> vertices = new List<PointRGB>(rows * cols); Mesh surface = new Mesh(); for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; // generates a random color int red = (int)(y * y * 30); int green = (int)(x * x * 30); int blue = (int)(255 - f * f * 1000); // clamps color values lat 0-255 Utility.LimitRange<int>(0, ref red, 255); Utility.LimitRange<int>(0, ref green, 255); Utility.LimitRange<int>(0, ref blue, 255); vertices.Add(new PointRGB(x, y, f, (byte)red, (byte)green, (byte)blue)); } List<IndexTriangle> triangles = new List<IndexTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { triangles.Add(new IndexTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)); triangles.Add(new IndexTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface); } public static void TexturedPlain(Model model) { List<Point3D> vertices = new List<Point3D>(rows * cols); List<Point2D> texCoords = new List<Point2D>(rows * cols); Mesh surface = new Mesh(); for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; vertices.Add(new Point3D(x, y, f)); texCoords.Add(new Point2D((-x * 5) / (rows - 1), (-y * 5) / (cols - 1))); } Bitmap bmp = new Bitmap(Properties.Resources.Smiley); Material mat = new Material(bmp); model.Materials.Add("test", mat); List<RichTriangle> triangles = new List<RichTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { RichTriangle tri = new RichTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1); tri.T1 = tri.V1; tri.T2 = tri.V2; tri.T3 = tri.V3; triangles.Add(tri); tri = new RichTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols); tri.T1 = tri.V1; tri.T2 = tri.V2; tri.T3 = tri.V3; triangles.Add(tri); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); surface.TextureCoords = texCoords.ToArray(); surface.ColorMethod = colorMethodType.byEntity; surface.MaterialName = "test"; model.Entities.Add(surface); } public static void Smooth(Model model) { List<Point3D> vertices = new List<Point3D>(rows * cols); Mesh surface = new Mesh(); surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged; for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; vertices.Add(new Point3D(x, y, f)); } List<SmoothTriangle> triangles = new List<SmoothTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { triangles.Add(new SmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)); triangles.Add(new SmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface, 0, Color.Green); } public static void ColoredSmooth(Model model) { List<Point3D> vertices = new List<Point3D>(rows * cols); Mesh surface = new Mesh(); for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; vertices.Add(new Point3D(x, y, f)); } List<ColorSmoothTriangle> triangles = new List<ColorSmoothTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { // generates a random color int red = (255 - i * 100); int green = (255 - j * 50); int blue = 127; // clamps color values lat 0-255 Utility.LimitRange<int>(0, ref red, 255); Utility.LimitRange<int>(0, ref green, 255); Utility.LimitRange<int>(0, ref blue, 255); triangles.Add(new ColorSmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1, (byte)red, (byte)green, (byte)blue)); triangles.Add(new ColorSmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols, (byte)red, (byte)green, (byte)blue)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface, 0); } public static void MulticolorSmooth(Model model) { List<PointRGB> vertices = new List<PointRGB>(rows * cols); Mesh surface = new Mesh(); surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged; for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; // generates a random color int red = (int)(y * y * 30); int green = (int)(x * x * 30); int blue = (int)(255 - f * f * 1000); // clamps color values lat 0-255 Utility.LimitRange<int>(0, ref red, 255); Utility.LimitRange<int>(0, ref green, 255); Utility.LimitRange<int>(0, ref blue, 255); vertices.Add(new PointRGB(x, y, f, (byte)red, (byte)green, (byte)blue)); } List<SmoothTriangle> triangles = new List<SmoothTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { triangles.Add(new SmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)); triangles.Add(new SmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); model.Entities.Add(surface, 0); } public static void TexturedSmooth(Model model) { List<Point3D> vertices = new List<Point3D>(rows * cols); List<Point2D> texCoords = new List<Point2D>(rows * cols); Mesh surface = new Mesh(); for (int j = 0; j < rows; j++) for (int i = 0; i < cols; i++) { double x = -i / 5.0 - 2; double y = -j / 5.0 - 2; double f = 0; double den = Math.Sqrt(x * x + y * y); if (den != 0) f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den; vertices.Add(new Point3D(x, y, f)); texCoords.Add(new Point2D((-x * 5) / (rows - 1), (-y * 5) / (cols - 1))); } Bitmap bmp = new Bitmap(Properties.Resources.Smiley); Material mat = new Material(bmp); model.Materials.Add("test", mat); List<RichSmoothTriangle> triangles = new List<RichSmoothTriangle>((rows - 1) * (cols - 1) * 2); for (int j = 0; j < (rows - 1); j++) for (int i = 0; i < (cols - 1); i++) { RichSmoothTriangle tri = new RichSmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1); tri.T1 = tri.V1; tri.T2 = tri.V2; tri.T3 = tri.V3; triangles.Add(tri); tri = new RichSmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols); tri.T1 = tri.V1; tri.T2 = tri.V2; tri.T3 = tri.V3; triangles.Add(tri); } surface.Vertices = vertices.ToArray(); surface.Triangles = triangles.ToArray(); surface.TextureCoords = texCoords.ToArray(); surface.MaterialName = "test"; surface.ColorMethod = colorMethodType.byEntity; model.Entities.Add(surface, 0); } }
This language is not supported or no code example is available.
Imports System Imports System.Collections.Generic Imports System.Drawing Imports devDept.Eyeshot Imports devDept.Eyeshot.Entities Imports devDept.Geometry Namespace MeshSamples Friend Class Mesh Private Shared rows As Integer = 8 Private Shared cols As Integer = 8 Private Shared scale As Double = 4 Public Shared Sub Plain(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim surface As New Mesh() surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) Next Next Dim triangles As New List(Of IndexTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 triangles.Add(New IndexTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)) triangles.Add(New IndexTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface, 0, Color.Green) End Sub Public Shared Sub ColoredPlain(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim surface As New Mesh() For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) Next Next Dim triangles As New List(Of ColorTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 ' generates a random color Dim red As Integer = CInt(255 - i * 100) Dim green As Integer = CInt(255 - j * 50) Dim blue As Integer = 127 ' clamps color values lat 0-255 Utility.LimitRange(Of Integer)(0, red, 255) Utility.LimitRange(Of Integer)(0, green, 255) Utility.LimitRange(Of Integer)(0, blue, 255) triangles.Add(New ColorTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1, CByte(red), CByte(green), CByte(blue))) triangles.Add(New ColorTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols, CByte(red), CByte(green), CByte(blue))) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface, 0) End Sub Public Shared Sub MulticolorPlain(model As Model) Dim vertices As New List(Of PointRGB)(rows * cols) Dim surface As New Mesh() For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If ' generates a random color Dim red As Integer = CInt(y * y * 30) Dim green As Integer = CInt(x * x * 30) Dim blue As Integer = CInt(255 - f * f * 1000) ' clamps color values lat 0-255 Utility.LimitRange(Of Integer)(0, red, 255) Utility.LimitRange(Of Integer)(0, green, 255) Utility.LimitRange(Of Integer)(0, blue, 255) vertices.Add(New PointRGB(x, y, f, CByte(red), CByte(green), CByte(blue))) Next Next Dim triangles As New List(Of IndexTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 triangles.Add(New IndexTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)) triangles.Add(New IndexTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface) End Sub Public Shared Sub TexturedPlain(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim texCoords As New List(Of Point2D)(rows * cols) Dim surface As New Mesh() For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) texCoords.Add(New Point2D((-x * 5) / (rows - 1), (-y * 5) / (cols - 1))) Next Next Dim bmp As New Bitmap(Properties.Resources.Smiley) Dim mat As New Material(bmp) model.Materials.Add("test", mat) Dim triangles As New List(Of RichTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 Dim tri As New RichTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1) tri.T1 = tri.V1 tri.T2 = tri.V2 tri.T3 = tri.V3 triangles.Add(tri) tri = New RichTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols) tri.T1 = tri.V1 tri.T2 = tri.V2 tri.T3 = tri.V3 triangles.Add(tri) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() surface.TextureCoords = texCoords.ToArray() surface.ColorMethod = colorMethodType.byEntity surface.MaterialName = "test" model.Entities.Add(surface) End Sub Public Shared Sub Smooth(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim surface As New Mesh() surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) Next Next Dim triangles As New List(Of SmoothTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 triangles.Add(New SmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)) triangles.Add(New SmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface, 0, Color.Green) End Sub Public Shared Sub ColoredSmooth(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim surface As New Mesh() For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) Next Next Dim triangles As New List(Of ColorSmoothTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 ' generates a random color Dim red As Integer = (255 - i * 100) Dim green As Integer = (255 - j * 50) Dim blue As Integer = 127 ' clamps color values lat 0-255 Utility.LimitRange(Of Integer)(0, red, 255) Utility.LimitRange(Of Integer)(0, green, 255) Utility.LimitRange(Of Integer)(0, blue, 255) triangles.Add(New ColorSmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1, CByte(red), CByte(green), CByte(blue))) triangles.Add(New ColorSmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols, CByte(red), CByte(green), CByte(blue))) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface, 0) End Sub Public Shared Sub MulticolorSmooth(model As Model) Dim vertices As New List(Of PointRGB)(rows * cols) Dim surface As New Mesh() surface.NormalAveragingMode = Mesh.normalAveragingType.Averaged For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If ' generates a random color Dim red As Integer = CInt(y * y * 30) Dim green As Integer = CInt(x * x * 30) Dim blue As Integer = CInt(255 - f * f * 1000) ' clamps color values lat 0-255 Utility.LimitRange(Of Integer)(0, red, 255) Utility.LimitRange(Of Integer)(0, green, 255) Utility.LimitRange(Of Integer)(0, blue, 255) vertices.Add(New PointRGB(x, y, f, CByte(red), CByte(green), CByte(blue))) Next Next Dim triangles As New List(Of SmoothTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 triangles.Add(New SmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1)) triangles.Add(New SmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols)) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() model.Entities.Add(surface, 0) End Sub Public Shared Sub TexturedSmooth(model As Model) Dim vertices As New List(Of Point3D)(rows * cols) Dim texCoords As New List(Of Point2D)(rows * cols) Dim surface As New Mesh() For j As Integer = 0 To rows - 1 For i As Integer = 0 To cols - 1 Dim x As Double = -i / 5.0 - 2 Dim y As Double = -j / 5.0 - 2 Dim f As Double = 0 Dim den As Double = Math.Sqrt(x * x + y * y) If den <> 0 Then f = scale * Math.Sin(Math.Sqrt(x * x + y * y)) / den End If vertices.Add(New Point3D(x, y, f)) texCoords.Add(New Point2D((-x * 5) / (rows - 1), (-y * 5) / (cols - 1))) Next Next Dim bmp As New Bitmap(Properties.Resources.Smiley) Dim mat As New Material(bmp) model.Materials.Add("test", mat) Dim triangles As New List(Of RichSmoothTriangle)((rows - 1) * (cols - 1) * 2) For j As Integer = 0 To (rows - 1) - 1 For i As Integer = 0 To (cols - 1) - 1 Dim tri As New RichSmoothTriangle(i + j * cols, i + j * cols + 1, i + (j + 1) * cols + 1) tri.T1 = tri.V1 tri.T2 = tri.V2 tri.T3 = tri.V3 triangles.Add(tri) tri = New RichSmoothTriangle(i + j * cols, i + (j + 1) * cols + 1, i + (j + 1) * cols) tri.T1 = tri.V1 tri.T2 = tri.V2 tri.T3 = tri.V3 triangles.Add(tri) Next Next surface.Vertices = vertices.ToArray() surface.Triangles = triangles.ToArray() surface.TextureCoords = texCoords.ToArray() surface.MaterialName = "test" surface.ColorMethod = colorMethodType.byEntity model.Entities.Add(surface, 0) End Sub End Class End Namespace
This language is not supported or no code example is available.