UNPKG

gojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

963 lines 64.6 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Point | GoJS API</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../assets/css/bootstrap.min.css"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <!-- non-fixed navbar --> <nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top"> <div class="container-fluid"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#navbar"> <a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> </div> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="../../index.html">Home</a></li> <li><a href="../../learn/index.html">Learn</a></li> <li><a href="../../samples/index.html">Samples</a></li> <li><a href="../../intro/index.html">Intro</a></li> <li><a href="../../api/index.html" target="api">API</a></li> <li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li> <li><a href="../../download.html">Download</a></li> <li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li> <li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li> <li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li> <li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="tsd-page-header"> <div class="tsd-page-toolbar"> <div class="container-fluid plr15"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">GoJS API</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container-fluid plr15"> <div class="top-copyright"> <!--<b>GoJS</b>&reg; Diagramming Components<br/>version &lt;br/&gt;version 2.1.18 for TypeScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a>--> <b>GoJS</b>&reg; Diagramming Components<br/>version 2.1.18<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <div> <h1>Class Point</h1> </div> </div> </div> </div> </header> <div class="container-fluid container-main plr15"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">Point</span> </li> </ul> </section> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <p>A Point represents an x- and y-coordinate pair in two-dimensional space.</p> <p>Use the static functions <a href="Point.html#static-parse">Point.parse</a> and <a href="Point.html#static-stringify">Point.stringify</a> to convert to and from a standard string representation that is independent of the current locale.</p> <p>When an instance of this class is the value of a property of a <a href="GraphObject.html">GraphObject</a> class or <a href="Diagram.html">Diagram</a> or <a href="CommandHandler.html">CommandHandler</a> or a <a href="Tool.html">Tool</a> class, you should treat the object as if it were frozen or read-only -- you cannot modify its properties. This allows the property to return a value without allocating a new instance. If you need to do your own calculations with the value, call <a href="Point.html#copy">copy</a> to make a new instance with the same values that you can modify.</p> <p>Many methods modify the object&#39;s properties and then return a reference to &quot;this&quot; object. The only instance method to allocate a new object is the <a href="Point.html#copy">copy</a> method. The static <a href="Point.html#static-parse">Point.parse</a> method also allocates a new object.</p> <p>The &quot;Debug&quot; implementation of this class is significantly slower than the &quot;Release&quot; implementation, mostly due to additional error checking.</p> <p>You cannot inherit from this class.</p> </div> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Point.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Point.html#x" class="tsd-kind-icon">x</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Point.html#y" class="tsd-kind-icon">y</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#add" class="tsd-kind-icon">add</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#copy" class="tsd-kind-icon">copy</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#direction" class="tsd-kind-icon">direction</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Point.html#static-direction" class="tsd-kind-icon">direction</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#directionPoint" class="tsd-kind-icon">direction<wbr>Point</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Point.html#static-distanceLineSegmentSquared" class="tsd-kind-icon">distance<wbr>Line<wbr>Segment<wbr>Squared</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#distanceSquared" class="tsd-kind-icon">distance<wbr>Squared</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Point.html#static-distanceSquared" class="tsd-kind-icon">distance<wbr>Squared</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#distanceSquaredPoint" class="tsd-kind-icon">distance<wbr>Squared<wbr>Point</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#equalTo" class="tsd-kind-icon">equal<wbr>To</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#equals" class="tsd-kind-icon">equals</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#isReal" class="tsd-kind-icon">is<wbr>Real</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#normalize" class="tsd-kind-icon">normalize</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#offset" class="tsd-kind-icon">offset</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Point.html#static-parse" class="tsd-kind-icon">parse</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#projectOntoLineSegment" class="tsd-kind-icon">project<wbr>Onto<wbr>Line<wbr>Segment</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#projectOntoLineSegmentPoint" class="tsd-kind-icon">project<wbr>Onto<wbr>Line<wbr>Segment<wbr>Point</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#rotate" class="tsd-kind-icon">rotate</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#scale" class="tsd-kind-icon">scale</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#set" class="tsd-kind-icon">set</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#setRectSpot" class="tsd-kind-icon">set<wbr>Rect<wbr>Spot</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#setSpot" class="tsd-kind-icon">set<wbr>Spot</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#setTo" class="tsd-kind-icon">set<wbr>To</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#snapToGrid" class="tsd-kind-icon">snap<wbr>ToGrid</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#snapToGridPoint" class="tsd-kind-icon">snap<wbr>ToGrid<wbr>Point</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Point.html#static-stringify" class="tsd-kind-icon">stringify</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Point.html#subtract" class="tsd-kind-icon">subtract</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"> <a name="constructor" class="tsd-anchor"></a> <h3> constructor </h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">new <wbr>Point<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>The default constructor produces the Point(0,0). This constructor may take either zero arguments or two arguments.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> x: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The x value.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> y: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The y value.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="x" class="tsd-anchor"></a> <h3> x <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the x value of the Point.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="y" class="tsd-anchor"></a> <h3> y <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the y value of the Point.</p> </div> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="add" class="tsd-anchor"></a> <h3> add </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">add<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this point so that is the sum of the current Point and the x and y co-ordinates of the given Point.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#offset">offset</a>, <a href="Point.html#subtract">subtract</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>The Point to add to this Point.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="copy" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> copy </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">copy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Create a copy of this Point, with the same values.</p> </div> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="direction" class="tsd-anchor"></a> <h3> direction </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">direction<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Compute the angle from this Point to a given (px,py) point. However, if the point is the same as this Point, the direction is zero.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#directionPoint">directionPoint</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> <p>the angle, in degrees, of the line from this Point to the given point.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"> <a name="static-direction" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> direction </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"> <li class="tsd-signature tsd-kind-icon">direction<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This static function returns the angle in degrees of the line from point P to point Q.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>qx: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>qy: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="directionPoint" class="tsd-anchor"></a> <h3> direction<wbr>Point </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">direction<wbr>Point<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Compute the angle from this Point to a given Point. However, if the given Point is the same as this Point, the direction is zero.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#direction">direction</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>the other Point to which to measure the relative angle.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> <p>the angle, in degrees, of the line from this Point to the given point.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"> <a name="static-distanceLineSegmentSquared" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> distance<wbr>Line<wbr>Segment<wbr>Squared </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"> <li class="tsd-signature tsd-kind-icon">distance<wbr>Line<wbr>Segment<wbr>Squared<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, ax<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, ay<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, bx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, by<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This static function returns the square of the distance from the point P to the finite line segment from point A to point B.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>ax: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>ay: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>bx: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>by: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> <p>the euclidean distance.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="distanceSquared" class="tsd-anchor"></a> <h3> distance<wbr>Squared </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">distance<wbr>Squared<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Returns the square of the distance from this point to a given point (px, py).</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#distanceSquaredPoint">distanceSquaredPoint</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> <p>the square of the euclidean distance.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"> <a name="static-distanceSquared" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> distance<wbr>Squared </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"> <li class="tsd-signature tsd-kind-icon">distance<wbr>Squared<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This static function returns the square of the distance from the point P to the point Q.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>qx: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>qy: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="distanceSquaredPoint" class="tsd-anchor"></a> <h3> distance<wbr>Squared<wbr>Point </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">distance<wbr>Squared<wbr>Point<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Returns the square of the distance from this Point to a given Point.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#distanceSquared">distanceSquared</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>the other Point to measure to.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4> <p>the square of the euclidean distance.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="equalTo" class="tsd-anchor"></a> <h3> equal<wbr>To </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">equal<wbr>To<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Indicates whether the given point (x, y) is equal to this Point.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#equals">equals</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>True if the two Points have identical X and Y values, false otherwise.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="equals" class="tsd-anchor"></a> <h3> equals </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">equals<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Indicates whether the given Point is equal to this Point.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#equalTo">equalTo</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>The Point to compare to the current Point.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>True if the two Points have identical X and Y values, false otherwise.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="isReal" class="tsd-anchor"></a> <h3> is<wbr>Real </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">is<wbr>Real<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>True if this Point has X and Y values that are real numbers and not infinity.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="normalize" class="tsd-anchor"></a> <h3> normalize </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">normalize<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that its X and Y values have been normalized to a unit length. However, if this Point is the origin (zero, zero), its length remains zero.</p> </div> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="offset" class="tsd-anchor"></a> <h3> offset </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">offset<span class="tsd-signature-symbol">(</span>dx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, dy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this point by shifting its values with the given DX and DY offsets.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#add">add</a>, <a href="Point.html#subtract">subtract</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>dx: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>dy: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"> <a name="static-parse" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagStatic">Static</span> parse </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"> <li class="tsd-signature tsd-kind-icon">parse<span class="tsd-signature-symbol">(</span>str<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This static function can be used to read in a <a href="Point.html">Point</a> from a string that was produced by <a href="Point.html#static-stringify">Point.stringify</a>.</p> <p><code>go.Point.parse(&quot;1 2&quot;)</code> produces the Point <code>new go.Point(1, 2)</code>.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>str: <span class="tsd-signature-type">string</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="projectOntoLineSegment" class="tsd-anchor"></a> <h3> project<wbr>Onto<wbr>Line<wbr>Segment </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">project<wbr>Onto<wbr>Line<wbr>Segment<span class="tsd-signature-symbol">(</span>px<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, py<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, qy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this point to be the closest point to this point that is on a finite line segment.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.3</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>px: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>one end of the finite line segment</p> </div> </li> <li> <h5>py: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>one end of the finite line segment</p> </div> </li> <li> <h5>qx: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>the other end of the finite line segment</p> </div> </li> <li> <h5>qy: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>the other end of the finite line segment</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this modified Point</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="projectOntoLineSegmentPoint" class="tsd-anchor"></a> <h3> project<wbr>Onto<wbr>Line<wbr>Segment<wbr>Point </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">project<wbr>Onto<wbr>Line<wbr>Segment<wbr>Point<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a>, q<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this point to be the closest point to this point that is on a finite line segment.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.3</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>one end of the finite line segment</p> </div> </li> <li> <h5>q: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>the other end of the finite line segment</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this modified Point</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="rotate" class="tsd-anchor"></a> <h3> rotate </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">rotate<span class="tsd-signature-symbol">(</span>angle<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that has been rotated about the origin by the given angle.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>angle: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>an angle in degrees.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="scale" class="tsd-anchor"></a> <h3> scale </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">scale<span class="tsd-signature-symbol">(</span>sx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, sy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that its X and Y values have been scaled by given factors along the X and Y axes.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>sx: <span class="tsd-signature-type">number</span></h5> </li> <li> <h5>sy: <span class="tsd-signature-type">number</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="set" class="tsd-anchor"></a> <h3> set </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">set<span class="tsd-signature-symbol">(</span>p<span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that its X and Y values are the same as the given Point.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>p: <a href="Point.html" class="tsd-signature-type">Point</a></h5> <div class="tsd-comment tsd-typography"> <p>the given Point.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="setRectSpot" class="tsd-anchor"></a> <h3> set<wbr>Rect<wbr>Spot </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">set<wbr>Rect<wbr>Spot<span class="tsd-signature-symbol">(</span>r<span class="tsd-signature-symbol">: </span><a href="Rect.html" class="tsd-signature-type">Rect</a>, spot<span class="tsd-signature-symbol">: </span><a href="Spot.html" class="tsd-signature-type">Spot</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that its X and Y values correspond to a particular <a href="Spot.html">Spot</a> in a given Rect.</p> <p>The result is meaningless if <a href="Spot.html#isNoSpot">Spot.isNoSpot</a> is true for the given Spot.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#setSpot">setSpot</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>r: <a href="Rect.html" class="tsd-signature-type">Rect</a></h5> <div class="tsd-comment tsd-typography"> <p>the Rect for which we are finding the point.</p> </div> </li> <li> <h5>spot: <a href="Spot.html" class="tsd-signature-type">Spot</a></h5> <div class="tsd-comment tsd-typography"> <p>the Spot; <a href="Spot.html#isSpot">Spot.isSpot</a> must be true for this Spot.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="setSpot" class="tsd-anchor"></a> <h3> set<wbr>Spot </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">set<wbr>Spot<span class="tsd-signature-symbol">(</span>x<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, y<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, w<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, h<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, spot<span class="tsd-signature-symbol">: </span><a href="Spot.html" class="tsd-signature-type">Spot</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Point.html" class="tsd-signature-type">Point</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Modify this Point so that its X and Y values correspond to a particular <a href="Spot.html">Spot</a> in a given rectangle.</p> <p>The result is meaningless if <a href="Spot.html#isNoSpot">Spot.isNoSpot</a> is true for the given Spot.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Point.html#setRectSpot">setRectSpot</a></p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>x: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The X coordinate of the Rect for which we are finding the point.</p> </div> </li> <li> <h5>y: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The Y coordinate of the Rect for which we are finding the point.</p> </div> </li> <li> <h5>w: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The Width of the Rect for which we are finding the point.</p> </div> </li> <li> <h5>h: <span class="tsd-signature-type">number</span></h5> <div class="tsd-comment tsd-typography"> <p>The Height of the Rect for which we are finding the point.</p> </div> </li> <li> <h5>spot: <a href="Spot.html" class="tsd-signature-type">Spot</a></h5> <div class="tsd-comment tsd-typography"> <p>the Spot; <a href="Spot.html#isSpot">Spot.isSpot</a> must be true for this Spot.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Point.html" class="tsd-signature-type">Point</a></h4> <p>this the point of the spot in the rectangle.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="setTo" class="tsd-anchor"></a> <h3> set<wbr>To </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">set<wbr>To<span class="tsd-signature-symbol">(</sp