SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Extrusion of edges algorithm in c++
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 30-01-2006, 01:06 AM   #1
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Thanks: 0
Thanked 18 Times in 18 Posts
Default Extrusion of edges algorithm in c++

Alright, people, another issue here.
To make a modeling system using poly by poly technique, first, I create a plane: 2 vectors with a projection between them.
and then I have this issue: Two sides are vectors, but the other two are not. Is there any way I can convert those 2 sides to vectors so I can manipulate them?

heres a little diagram I drew in Paint (i didnt feel like starting up photoshop) to help you understand my problem.
Attached Thumbnails
Click image for larger version

Name:	vectors.jpg
Views:	135
Size:	40.5 KB
ID:	26694  
__________________
Live the life you love, love the life you live
MattTheMan is offline   Reply With Quote
Old 30-01-2006, 01:52 AM   #2
Joopson
Registered User
 
Joopson's Avatar
 
Join Date: Jul 2005
Location: Los Angeles, CA
Posts: 2,313
Thanks: 1
Thanked 33 Times in 33 Posts
Default

umm,,,... soryy, i d k, im lost
__________________
Environment Artist @ Plastic Piranha
www.joopson.com
Joopson is offline   Reply With Quote
Old 05-02-2006, 05:21 PM   #3
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Thanks: 0
Thanked 18 Times in 18 Posts
Default

Ok, I figured it out. This is sooo obvious now. Instead of just having 2 vectors per quad, now I have 5.

It has 2 vectors sharing each vertex, so I can extrude on all sides, plus I can manipulate each vertice, and it will affect the opposite end as well, (when I tried this on my old program, it crashed) because it is triangulated. Though, I don't have to display the triangulating edge, the computer knows its still there.
Attached Thumbnails
Click image for larger version

Name:	vectors.jpg
Views:	124
Size:	55.0 KB
ID:	26759  
__________________
Live the life you love, love the life you live
MattTheMan is offline   Reply With Quote
Old 06-02-2006, 01:38 AM   #4
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Thanks: 0
Thanked 18 Times in 18 Posts
Default

You know, I took a better look at that code, and found that using vectors as edges is a very bad thing to do.

Vectors being lines in 3d space starting at point O and going on in a constant direction forever, unless affected by some other object.

My method included using only parts of vectors as edges, and that took a bunch of code.

Simply using vertices (3 floating point numbers: x, y, and z) like this:

class vertex{
Public:
float x, y, z;
};

and triangular faces like this:

class tri{
Public:
float vertex(x, y, z), vertex(x, y, z), vertex(x, y, z);
};

and finally, the entire polygon like this:

class poly{
Public:
float tri(vertex(x, y, z)), vertex(x, y, z)), vertex(x, y, z)), tri(vertex(x, y, z))
};

allows me to edit polygons really easily.

by the way, that last one is a plane

and then I can have an array of polygons making up the entire scene.

This also makes it easier for me to do some collision testing, like for split faces tool and stuff. ALso makes booleans a breeze. In the end, this will help me make a .obj or .3ds exporter for my raytracer.

cya later,
Matt
__________________
Live the life you love, love the life you live
MattTheMan is offline   Reply With Quote
Old 06-02-2006, 05:31 PM   #5
gster123
Moderator
 
gster123's Avatar
 
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Thanks: 1
Thanked 51 Times in 45 Posts
Default

Your doin well on the old programming mate!!

What you using to do it with??

I did 2 years of C++ programming then gave it up, couldent get my head round it, thinbk I'm gonna have to get back into it tho!!
gster123 is offline   Reply With Quote
Old 06-02-2006, 08:54 PM   #6
MattTheMan
Registered User
 
MattTheMan's Avatar
 
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Thanks: 0
Thanked 18 Times in 18 Posts
Default

Yah, I need sum1 to help me >.< lol just kidding. I still need to get some stuff done on my raytracer, I'm working on the scene building code now.

Im using Bloodshed Dev C++ 5.0 beta for my compiler: its free and its considered one of the best c++ compilers out there

I think everyone should know some programming, at least everyone in the comp industry. I do it for fun, but I might want to be a programmer for a career.

cya later,
Matt
__________________
Live the life you love, love the life you live
MattTheMan is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.