Accessing functionality of class from documentation.

Hello,

I am writing in order to ask how to access specific function from Hemesh class WB_Line2D.

However, this question has little to do with the library itself.

Every function that described in "Method summary" and has a name WB_Line2D are visible in Eclipse editor.

But I want to have access to function that I marked in yellow. The link to printscreen of documentation:documentation The link to printscreen of eclipse:eclipse

How to access function: setFromPoints(WB_XY p1, WB_XY p2) ?

Thanks.

Answers

  • Answer ✓

    You have to learn what a static method is...

    You can call a static method (marked as such in the left column of the documentation, before the return type) directly with the class name: getBisector() is not dependent of the values in the class, it just does a mathematical operation and returns a value. It acts like a good old function not access global variables, in Processing terms.

    A method not marked as static must be called from an instance, an object of the specified class, created with new. It will (probably) access the state of the instance, its variables (fields), which are specific to this particular instance.

    This concept isn't frequently used in Processing, admittedly.

  • edited December 2013

    Dear PhiLho,

    Thank you for a reply.

    I could access it by, without calling actual function " splitLines.add(new WB_Line2D(a,b));"

    I wonder why...

    Thanks, Petras.

Sign In or Register to comment.