Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2008, 02:31 AM
Member
 
Join Date: May 2008
Posts: 3
shkelqa is on a distinguished road
solution for my project
I need to help me in my project:


Write a 3D Bézier surface editor. Display the control points of the surface as square dots. Allow the user to select and move a control point with mouse operations and update the surface accordingly.

Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-27-2008, 06:48 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Hi shelqa,

Welcome to our community.

Before post again here please read FAQ page of our community. And at the same time, please keep in mind that no one here in our community wants just give a code. What we do is, giving helping hand to anyone who stuck with anything related to Java.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-28-2008, 01:25 AM
Member
 
Join Date: May 2008
Posts: 3
shkelqa is on a distinguished road
repost
Quote:
Originally Posted by Eranga View Post
Hi shelqa,

Welcome to our community.

Before post again here please read FAQ page of our community. And at the same time, please keep in mind that no one here in our community wants just give a code. What we do is, giving helping hand to anyone who stuck with anything related to Java.



This is code:

import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class BSpline extends JApplet {
public static void main(String s[]) {
JFrame frame = new JFrame();
frame.setTitle("B-Spline");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
JApplet applet = new BSpline();
applet.init();
frame.getContentPane().add(applet);
frame.pack();
frame.setVisible(true);
}
public void init() {
JPanel panel = new BSplinePanel();
getContentPane().add(panel);
}
}

class BSplinePanel extends JPanel
implements MouseListener, MouseMotionListener {
Vector points = null;
boolean completed = true;
public BSplinePanel() {
setPreferredSize(new Dimension(640, 480));
setBackground(Color.white);
addMouseListener(this);
addMouseMotionListener(this);
points = new Vector();
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
Point p0 = null;
Point p1 = null;
Point p2 = null;
Point p3 = null;
float x1, y1, x2, y2, x3, y3, x4, y4;
Iterator it = points.iterator();
if (it.hasNext()) {
p1 = (Point)(it.next());
}
while (it.hasNext()) {
p2 = (Point)(it.next());
g2.drawLine(p1.x, p1.y, p2.x, p2.y);
p1 = p2;
}

GeneralPath spline = new GeneralPath();
int n = points.size();
if (n == 0) return;
p1 = (Point)points.get(0);
spline.moveTo(p1.x, p1.y);
g2.drawRect(p1.x-3, p1.y-3, 6, 6);
p1 = (Point)points.get(1);
p2 = (Point)points.get(2);
p3 = (Point)points.get(3);
x1 = p1.x;
y1 = p1.y;
x2 = (p1.x + p2.x)/2.0f;
y2 = (p1.y + p2.y)/2.0f;
x4 = (2.0f*p2.x+p3.x)/3.0f;
y4 = (2.0f*p2.y+p3.y)/3.0f;
x3 = (x2+x4)/2.0f;
y3 = (y2+y4)/2.0f;
spline.curveTo(x1, y1, x2, y2, x3, y3);
g2.drawRect((int)x1-3, (int)y1-3, 6, 6);
g2.drawRect((int)x2-3, (int)y2-3, 6, 6);
g2.drawRect((int)x3-3, (int)y3-3, 6, 6);
for (int i = 2; i < n - 4; i++) {
p1 = p2;
p2 = p3;
p3 = (Point)points.get(i+2);
x1 = x4;
y1 = y4;
x2 = (p1.x+2.0f*p2.x)/3.0f;
y2 = (p1.y+2.0f*p2.y)/3.0f;
x4 = (2.0f*p2.x+p3.x)/3.0f;
y4 = (2.0f*p2.y+p3.y)/3.0f;
x3 = (x2+x4)/2.0f;
y3 = (y2+y4)/2.0f;
spline.curveTo(x1,y1,x2,y2,x3,y3);
g2.drawRect((int)x1-3, (int)y1-3, 6, 6);
g2.drawRect((int)x2-3, (int)y2-3, 6, 6);
g2.drawRect((int)x3-3, (int)y3-3, 6, 6);
}
p1 = p2;
p2 = p3;
p3 = (Point)points.get(n-2);
x1 = x4;
y1 = y4;
x2 = (p1.x+2.0f*p2.x)/3.0f;
y2 = (p1.y+2.0f*p2.y)/3.0f;
x4 = (p2.x+p3.x)/2.0f;
y4 = (p2.y+p3.y)/2.0f;
x3 = (x2+x4)/2.0f;
y3 = (y2+y4)/2.0f;
spline.curveTo(x1,y1,x2,y2,x3,y3);
g2.drawRect((int)x1-3, (int)y1-3, 6, 6);
g2.drawRect((int)x2-3, (int)y2-3, 6, 6);
g2.drawRect((int)x3-3, (int)y3-3, 6, 6);
p2 = p3;
p3 = (Point)points.get(n-1);
x1 = x4;
y1 = y4;
x2 = p2.x;
y2 = p2.y;
x3 = p3.x;
y3 = p3.y;
spline.curveTo(x1,y1,x2,y2,x3,y3);
g2.drawRect((int)x1-3, (int)y1-3, 6, 6);
g2.drawRect((int)x2-3, (int)y2-3, 6, 6);
g2.drawRect((int)x3-3, (int)y3-3, 6, 6);
g2.draw(spline);
}
public void mouseClicked(MouseEvent ev) {
}
public void mouseEntered(MouseEvent ev) {
}
public void mouseExited(MouseEvent ev) {
}
public void mousePressed(MouseEvent ev) {
Graphics g = getGraphics();
if (completed) {
points.clear();
completed = false;
}
if (ev.getClickCount() == 1) {
Point p =ev.getPoint();
points.add(p);
g.fillOval(p.x-3, p.y-3, 6, 6);
}
}
public void mouseReleased(MouseEvent ev) {
if (ev.getClickCount() > 1) {
completed = true;
repaint();
}
}
public void mouseMoved(MouseEvent ev) {
}
public void mouseDragged(MouseEvent ev) {
}
}

and I need to modify to write my project
By SHKELQA
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-28-2008, 05:53 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
You mean wants to add you name there?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-29-2008, 12:31 AM
Member
 
Join Date: May 2008
Posts: 3
shkelqa is on a distinguished road
From Shkelqim about Bezier
I upload four codes with java that you can help me in my project
My project is:
Write a 3D Bézier surface editor. Display the control points of the surface as square dots. Allow the user to select and move a control point with mouse operations and update the surface accordingly
and before need to modify codes in attach at complete
Attached Files
File Type: txt BezierCurve.java.txt (1.3 KB, 0 views)
File Type: txt BezierSurface.java.txt (1.7 KB, 1 views)
File Type: txt TestBezierCurve.java.txt (2.0 KB, 2 views)
File Type: txt TestBezierSurface.java.txt (2.5 KB, 1 views)

Last edited by shkelqa : 05-29-2008 at 12:44 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
solution for my project themburu Java Applets 4 05-21-2008 03:03 PM
Please need solution prithvi New To Java 4 04-22-2008 03:27 PM
Simple serverless chat solution goodjonx Networking 3 01-07-2008 05:25 PM
Help Finding Compiler error solution please jamesr2b New To Java 2 07-25-2007 03:13 PM
Friends could u plz give me solution 4 this Saritha Database 1 06-15-2007 06:42 PM


All times are GMT +3. The time now is 03:06 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org