Converting a curve into a surface based on mathematical graphics

Source: Internet
Author: User

(Conversion) This article will show several basic graphics generation algorithms, including: Circle surface, ball, cylindrical, cone, ring, circle, spiral ring, circle screw, five-pointed ring, pyramid, positive 8 area. use the script code of the custom syntax to generate a mathematical image. for related software, see: Mathematical graphics visualization tool. This software is free and open-source.

A previous article: Mathematical graphics converts a curve (curve) into a curved tube. After writing it, I realized that this script code for generating a curved tube is too complicated. if the input is a curve + tube radius, it can be changed to a sentence. I need to add a line after the code for generating the curve to convert it into a curved tube. pipe = radius [0.5], type [0]

After being parsed by the "pipe" script, I thought that the curve could be transformed into a curved surface through rotation, scaling, and translation. OK, and the following syntax is implemented:

 

(1) rotate any line in the space to generate a rotating Surface

Rotate = anchor [0, 0, 0], axis [0, 1, 0], angle [0, 2 * Pi]

(2) Move the vertex along any orientation and a cylindrical surface can be generated.
Translate = dir [0, 1, 0], DIS [0, 5]

(3) scale the vertices on the curve based on any point in the space
Scale = anchor [0, 0, 0], X [1, 0], Z [1, 0]

Finally, a dimension data is added from the curve to the surface, and the data size needs to be set: surface_slices = 72

The following shows the graphics and script code generated using these new statements:

 

Circular Surface

vertices = 360u = from 0 to (2*PI)r = 5.0x = r*sin(u)y = r*cos(u)scale = anchor[0, 0, 0], x[1, 0], y[1, 0]

 

Ball

For more information about the algorithm used to generate a sphere, see sphere of mathematical graphics.

vertices = 360u = from 0 to (PI)r = 2.0x = r*sin(u)y = r*cos(u)rotate = anchor[0, 0, 0], axis[0,1, 0], angle[0, 2*PI]

 

Cylindrical

For general cylindrical generation algorithm, see: cylindrical surface of mathematical graphics

vertices = 360u = from 0 to (2*PI)r = 2.0x = r*sin(u)z = r*cos(u)translate = dir[0, 1, 0], dis[0, 5]

 

Cone

For general cone generation algorithms, see the cone of mathematical graphics.

vertices = 360u = from 0 to (2*PI)r = 2.0x = r*sin(u)z = r*cos(u)translate = dir[0, 1, 0], dis[0, 5]scale = anchor[0, 0, 0], x[1, 0], z[1, 0]

 

Ring

For general ring generation algorithms, see the ring of mathematical graphics.

vertices = 360u = from 0 to (2*PI)r = 2.0x = r*sin(u) + 5y = r*cos(u)surface_slices = 72rotate = anchor[0, 0, 0], axis[0,1, 0], angle[0, 2*PI]

 

Tube

vertices = 360u = from 0 to (2*PI)r = 5.0x = r*sin(u)z = r*cos(u)pipe = radius[0.5], type[0]

 

Spiral Ring

For general algorithms for generating spiral rings, see spiral tubes in mathematical graphics.

vertices = 100u = from 0 to (2*PI)r = 1.0x = r*sin(u) + 5y = r*cos(u)surface_slices = 200rotate = anchor[0, 0, 0], axis[0, 1, 0], angle[0, 8*PI]translate = dir[0, 1, 0], dis[0, 9]

 

Spiral

vertices = 100u = from 0 to (2*PI)r = 1.0x = r*sin(u) + 5y = r*cos(u)surface_slices = 200scale = anchor[0, 0, 0], x[1, 0], y[1, 0]rotate = anchor[0, 0, 0], axis[0, 1, 0], angle[0, 8*PI]translate = dir[0, 1, 0], dis[0,6]

 

Wujiaohuan

vertices =6u = from 0 to (2*PI)r = 2.0x = r*sin(u) + 5y = r*cos(u)surface_slices = 6rotate = anchor[0, 0, 0], axis[0,1, 0], angle[0, 2*PI]

 

Pyramid

vertices =5u = from 0 to (2*PI)r = 2.0x = r*sin(u)z = r*cos(u)surface_slices = 3translate = dir[0, 1, 0], dis[0, 2]scale = anchor[0, 0, 0], x[1, 0], z[1, 0]

 

Positive 8 face

vertices =3u = from 0 to (PI)r = 2.0x = r*sin(u)y = r*cos(u)surface_slices = 5rotate = anchor[0, 0, 0], axis[0,1, 0], angle[0, 2*PI]

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.