Posted by: link Aug 23 2006, 06:16 PM
how can i draw a curved line??
Posted by: kiroukou Aug 23 2006, 06:20 PM
Hello,
You have to create a primitiv object like Line3D and use the correct face object.
Bye
Posted by: link Aug 23 2006, 06:23 PM
i kwon is some like the primitive class Line3D
but i need to use the CurvedEdge3D i think so
Posted by: kiroukou Aug 23 2006, 06:24 PM
You should look at the Line3D class, and creaet your CurvedLine3D or whatever.
Should be pretty easy to do.
++
Posted by: link Aug 23 2006, 06:28 PM
CODE
/*
# ***** BEGIN LICENSE BLOCK *****
Copyright the original author or authors.
Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# ***** END LICENSE BLOCK *****
*/
import sandy.core.data.Vector;
import sandy.core.data.Vertex;
import sandy.core.Object3D;
import sandy.core.face.Edge3D;
import sandy.primitive.Primitive3D;
import sandy.skin.SimpleLineSkin;
import sandy.core.face.CurvedEdge3D
class sandy.primitive.CurvedLine3D extends Object3D implements Primitive3D
{
public function CurvedLine3D ( a:Vector, b:Vector, c:Vector)
{
super ();
if( arguments.length < 3 )
{
trace('CurvedLine3D::Number of arguments to low');
}
else
{
for( var i:Number = 0; i < arguments.length; i++ )
{
aPoints.push
( new Vertex( arguments[i].x, - arguments[i].y, arguments[i].z ) );
}
generate ();
}
}
/**
* generate
*
* <p>Generate CurvedLine3D : </p>
*/
public function generate ( Void ) : Void
{
// initialisation
_aFaces = [];
var l:Number = aPoints.length;
for( var i:Number = 0; i < l-1; i++ )
{
addFace(
new CurvedEdge3D( this,aPoints[i], aPoints[i+1], aPoints[i+2] ) );
}
}
/**
* Set a Skin to the CurvedLine3D.
*
<p>This method will set the a new skin to the line, but the skin
must be a SimpleLineSkin instance.</p>
* @param SimpleLineSkin s The new SimpleLineSkin skin
*
@param bOverWrite Boolean,
overwrite or not all specific Faces's Skin
*
@return Boolean True to apply the skin to the
non default faces skins , false otherwise (default).
*/
public function setSkin( s:SimpleLineSkin, bOverWrite:Boolean ):Boolean
{
bOverWrite = (bOverWrite == undefined ) ? false : bOverWrite;
super.setSkin( s, bOverWrite );
return true;
}
}
what do you think?
Posted by: kiroukou Aug 23 2006, 06:32 PM
seems ok except:
for( var i:Number = 0; i < l-1; i++ )
that should be :
for( var i:Number = 0; i < l-2; i++ )
is it working?
Posted by: link Aug 23 2006, 06:36 PM
yup it's working =)
let me try
for( var i:Number = 0; i < l-2; i++ )
for( var i:Number = 0; i < l-2; i++ )
works fine too =)
thanks !