3D curved pipe

Source: Internet
Author: User
A 3D curved pipe is generated centered on a Smooth Spline curve.
A lot of friends on the Internet asked for this, so they wrote a demo. Of course, it was just a guide. In fact, the algorithm used to calculate the curve vertex is not very good, in some cases, the image will be distorted. I have never found the best solution, but I only have a compromise. Maybe, if there is a high hand in the number system, it may give me some theoretical guidance.

Code:
// A class used to draw a spline curve tube, 3D curved pipe
// Float ctrlpoint [8] [3] = {0.2f, 0.00f, 0.0f}, {0.3f, 0.00f, 0.0f },
{0.4f, 0.10f, 0.0f}, {0.5f, 0.20f, 0.0f}, {0.6f, 0.10f, 0.0f },
{0.7f, 0.00f, 0.0f}, {0.8f, 0.10f, 0.0f}, {0.90f, 0.0f, 0.0f }};

//
// M_tube.putpointdata (point, 0.02f, 0.05f );
//
//
// M_tube.draw (FACE); face: graphic card, line: line display
//
//
//
//

 


Sample Code download: http://www.physdev.com/phpbb/viewtopic.php? T = 121

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.