Node description and application example of extrusion Shape Extrusion

Source: Internet
Author: User

Node description and application example of extrusion Shape Extrusion
----------------------------
1. Nodes for extrusion:
Extrusion Node
 
Extrusion
{
Spine [0 0 0 0 1 0] # mfvec3f
Crosssection [1 1, 1-1,-1-1,-1, 1] # mfvec2f
Scale [1 1] # mfvec2f
Orientation [0 0 1 0] # mfrotation
Begincap true # sfbool
Endcap true # sfbool
CCW true # sfbool
Solid true # sfbool
Convex true # sfbool
Creaseangle 0 # sffloat
}

<Domain>:
Spine this field defines the keel line, including a series of three-dimensional points, connecting adjacent points in turn to get a line. The

Coordinates are defined on the local coordinate system of the node.

Crosssection defines a two-dimensional line, including a series of two-dimensional coordinates, and connects adjacent coordinate points in sequence to get

Piecewise linear line. This is first defined in the local sitting table of the node in the xz plane. The first number of two-dimensional coordinates is X

And zcoordinate.
/* We focus on the above two domains */

Scale this city defines two-dimensional line scaling parameters. In the xz plane of the Local Coordinate System of a node, the scale is changed.

Take the x-axis point as the reference point. The first number of values corresponds to the x-axis transformation, and the second number corresponds to the z-axis. Scaling

The value must be greater than zero. Generally, the number of values in this field is the same as that in the spine field.

. If only one value is specified for the city, this value is used for every two-dimensional line.

Transform.

Orientation this field defines the 3D Rotation Transformation Parameters. Generally, the number of values in this field is the same as that in the spine field.

The Rotation Transformation of two-dimensional line at each keel construction point. If only one value is specified for this field, the two-dimensional discount for each field

Line all use this value for transformation. Note that this rotation transformation is not defined in the Local Coordinate System of the node, but in the corresponding

Each keel is carried out on a special Coordinate System of constructor points.

Begincap this field indicates whether the extended body has a starting face (corresponding to the first constructor point in the keel ). If

If begincap is set to false, the starting end is not generated. Otherwise, the starting end is a two-dimensional fold

A polygon formed by the beginning and end of the line, which is in the xz plane of the first construction coordinate system of the keel.
 
Endcap indicates whether the extended object has a termination end (corresponding to the last constructor point in the keel ). If endcap =

False, the end is not terminated. Otherwise, the end is connected to the first and end of the two-dimensional line in the crosssection.

A polygon is located in the xz plane of the coordinate system of the last constructor.

The CCW extlusion node automatically generates the ry surface normal, which determines the relationship between the normal direction and the two-dimensional line direction.

When cow = true, the two-dimensional line direction (specified by the order defined by the discount point), the keel direction (determined by the keel construction point)

Right hand relationship to the normal direction; otherwise, when cow = false, two-dimensional line direction, keel

The direction should be left-handed. If the solid field is set to true, you can only view the field in the normal direction.

Geometric area.

Solid for a surface of a ry, the surface of the normal direction is considered as an "outer" surface, opposite to "inner"

Surface. When the solid field is true, only the "outer" surface is displayed, and the "inner" surface is not colored. When the ry is

When closed, this domain is used for browser optimization. If solid = false, it means "internal", "external" table

The surface must be displayed. the browser must calculate the two surfaces. In this case, if the material is used, a certain point on the surface is used on the two surfaces.

The same image point on the texture image.

Convex this field tells the viewer whether the ry is a complete convex body. If not, set this domain

False. The convex field is used by the browser for optimization.

Creaseangle this field affects the browser's processing of the edges between adjacent surfaces of the ry. Creaseangle specifies a large value

The angle value (radian) at 0. If the absolute value of the angle between the adjacent surface normal is smaller than this angle

The adjacent surface is smoothed, and the edges are invisible. This domain is usually used to generate a smooth surface.
 
<Event>:
Set-spine eventin mfvc3f to set the spine PATH value.
Set-crosssection eventin mfvec2f sets the value of the crosssection path.
Set-scale eventin mfvec2f sets the scale value.
Set-orientation eventin mfrotation: sets the value of orientation.

<Note>:
Extrusion nodes provide an effective and direct way to describe shapes in multiple shapes.

This method can be used for cross-section shapes formed by moving along a path in a space.

The crosssection field describes a 2D quasi-section on the x-zplane. Copy the crosssection

Spine path connections, scale or rotate according to the scale and orientation domain values, and then connect adjacent

The corresponding vertices of the intersection are connected to form the side of the object. If begincap endcap has been described,

A proper plane polygon cap (CAPS) can be added to the end of the constructed shape.

------------------------
2. The following figure shows the code for using this language:

# Fig

# User perspective
Viewpoint
{
Position 0 4 10
Description "look"
}
# Background
Background
{
Skycolor
[
0.0 0.2, 0.7,
0.0 0.5, 1.0,
1.0 1.0 1.0
]
Skyangle [1.309, 1.571]
}
Group
{
Children
[
Def body transform # Screw Pattern, extrusion shape
{
Children shape
{
Appearance def dcolor appearance
{
Material material
{
Diffusecolor. 2. 1. 32
Specularcolor. 31. 388. 388
Ambientintensity. 07
Shininess 1
}
}
Geometry def whorl Extrusion
{
Crosssection
[
0.05 0.08, 0 0.05,-0.05 0, 0
]
Spine []
Scale []
Begincap true
Endcap true
Solid true
}
}
}, # End body
Def top transform # Nail cap, cylindrical
{
Translation 0 5.05 0
Children shape
{
Appearance use dcolor
Geometry Cylinder
{
Radius 0.5
The height is 0.1.
}
}
},
Transform # nail body, cone
{
Translation 0 2.5 0
Rotation 1 0 3.14
Children shape
{
Appearance use dcolor
Geometry cone
{
Bottomradius 0.25
Height 5
Side true
}
}
},
Def myscript script
{
Field sffloat a 0.01
Eventout mfvec3f spin_changed
Eventout mfvec2f scal_changed

URL "vrmlscript:
Function initialize ()
{
Y_add = 0; // increment in the Y direction
Cent = math. PI/16; // The increment of the angle in the spiral.
Angles = 0.0;
SC = 0; // scaling ratio
N = 64*5;

For (I = 0; I <n-20; I ++)
{
B = angle/(64 * Math. Pi );
Part_x = B * Math. Cos (angle );
Part_z =-B * Math. Sin (angle );

/* Spin is the circle formed by a polygon approaching.

Incremental, forming a spiral rising shape. */
Spin_changed [I] = new sfvec3f (part_x, y_add, part_z );
Scal_changed [I] = new sfvec2f (SC, SC );
Angle + = cent;
Y_add + = 1/64;
SC + = 0.01;
}
}"
}
]
Route myscript. spin_changed to whorl. set_spine
Route myscript. scal_changed to whorl. set_scale
}

3. Explanation
Crosssection [] is a closed graph on the x-zplane. In this example, it is a triangle;
Spine [] is an array of (x, y, z) 3D coordinates drawn by crosssection graphs.
Scale [] scaling ratio of the shape at each spine point.

In fact, as long as the three-dimensional ry of High School has been learned, the extrusion style is simply a piece of cake.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.