DzLine3 object

OK this is driving me a bit nuts at the moment (and probably because I'm missing something very fundamental). I can't use any methods on a DzLine3 object, I just get the "undefined is not a function errors...
 

(function(){	var oLine = new DzLine3();	oLine.origin = new DzVec3( 0,0,0 );	oLine.end = new DzVec3( 1,1,1 );		var nLength = oLine.length();	print(nLength);	})();

always results in the follwoing output
 

Executing Script...Script Error: Line 7TypeError: Result of expression 'oLine.length' [undefined] is not a function.Stack Trace: ()@:7Error executing script on line: 7Script executed in 0 secs 2 msecs.

What am I missing?

Comments

  • HowieFarkesHowieFarkes Posts: 606

    Of course - what I really want to do is find the distance between 2 vectors - so if there's a better way of finding that out than creating a line between the 2 and getting its length, then I'm all ears.

  • Philemo_CarraraPhilemo_Carrara Posts: 1,175

    Of course - what I really want to do is find the distance between 2 vectors - so if there's a better way of finding that out than creating a line between the 2 and getting its length, then I'm all ears.

    Hi Howie,

    I think something like

    Vec1.subtract(Vec2).length()

    Should do the trick

     

  • HowieFarkesHowieFarkes Posts: 606

    Thank you, that worked a treat!

  • Richard HaseltineRichard Haseltine Posts: 99,524

    The exposed members of DzLine3 appear to be:

    objectName

    origin
    end
    destroyed(QObject*)
    destroyed()
    deleteLater()
    inherits(QString)
    className()
    toString()

    So no length() although it iis listed in the API refrence (but not in the DS3 scripting docs, which look more like the actual list of available members). Please bug report this.

Sign In or Register to comment.