blob: 2bf8eae1e7d796e0c327635742487c644b9f7945 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 -->
<title>Line (Apache SIS 1.4 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-10-05">
<meta name="description" content="declaration: module: org.apache.sis.util, package: org.apache.sis.math, class: Line">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.math.Line class">
<meta name="keywords" content="slope()">
<meta name="keywords" content="x0()">
<meta name="keywords" content="x()">
<meta name="keywords" content="y0()">
<meta name="keywords" content="y()">
<meta name="keywords" content="applyAsDouble()">
<meta name="keywords" content="translate()">
<meta name="keywords" content="setEquation()">
<meta name="keywords" content="setFromPoints()">
<meta name="keywords" content="fit()">
<meta name="keywords" content="clone()">
<meta name="keywords" content="equals()">
<meta name="keywords" content="hashCode()">
<meta name="keywords" content="toString()">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../../../../module-summary.html">Module</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li>Field</li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li><a href="#constructor-detail">Constr</a></li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="module-label-in-type">Module</span>&nbsp;<a href="../../../../module-summary.html">org.apache.sis.util</a></div>
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.math</a></div>
<h1 title="Class Line" class="title">Class Line</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance">Line</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html" title="class or interface in java.lang" class="external-link">Cloneable</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html" title="class or interface in java.util.function" class="external-link">Double­Unary­Operator</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Line</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
implements <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html" title="class or interface in java.util.function" class="external-link">DoubleUnaryOperator</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html" title="class or interface in java.lang" class="external-link">Cloneable</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></span></div>
<div class="block">Equation of a line in a two dimensional space (<var>x</var>,<var>y</var>).
A line can be expressed by the <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> equation
where <var>y₀</var> is the value of <var>y</var> at <var>x</var> = 0.
<p>The equation parameters for a <code>Line</code> object can be set at construction time or using one
of the <code>set­Line(…)</code> methods. The <var>y</var> value can be computed for a given <var>x</var>
value using the <a href="#y(double)"><code>y(double)</code></a> method. Method <a href="#x(double)"><code>x(double)</code></a> computes the converse and should
work even if the line is vertical.</p>
<h2 id="comparison-with-java2d-geometries-heading">Comparison with Java2D geometries</h2>
At the difference of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/geom/Line2D.html" title="class or interface in java.awt.geom" class="external-link"><code>Line2D</code></a> which is bounded by (<var>x₁</var>,<var>y₁</var>)
and (<var>x₂</var>,<var>y₂</var>) points, <code>Line</code> objects extend toward infinity.</div>
<dl class="notes">
<dt>Since:</dt>
<dd>0.5</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="Plane.html" title="class in org.apache.sis.math"><code>Plane</code></a></li>
<li><a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.html" title="class in org.apache.sis.referencing.operation.builder"><code>Linear­Transform­Builder</code></a></li>
<li><a href="../../../../../serialized-form.html#org.apache.sis.math.Line">Serialized Form</a></li>
</ul>
</dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">Line</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Constructs an uninitialized line.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(double,double)" class="member-name-link">Line</a><wbr>(double&nbsp;slope,
double&nbsp;y0)</code></div>
<div class="col-last odd-row-color">
<div class="block">Constructs a line with the specified slope and offset.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#applyAsDouble(double)" class="member-name-link">apply­As­Double</a><wbr>(double&nbsp;x)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Evaluates this equation for the given value.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="Line.html" title="class in org.apache.sis.math">Line</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clone()" class="member-name-link">clone</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a clone of this line.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#equals(java.lang.Object)" class="member-name-link">equals</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;object)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Compares this line with the specified object for equality.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#fit(double%5B%5D,double%5B%5D)" class="member-name-link">fit</a><wbr>(double[]&nbsp;x,
double[]&nbsp;y)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Given a set of data points <var>x</var>[0 … <var>n</var>-1], <var>y</var>[0 … <var>n</var>-1],
fits them to a straight line <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a
least-squares senses.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#fit(java.lang.Iterable)" class="member-name-link">fit</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html" title="class or interface in java.lang" class="external-link">Iterable</a>&lt;? extends <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/geometry/DirectPosition.html" title="class or interface in org.opengis.geometry" class="external-link">Direct­Position</a>&gt;&nbsp;points)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Given a sequence of points, fits them to a straight line
<var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a least-squares senses.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#fit(org.apache.sis.math.Vector,org.apache.sis.math.Vector)" class="member-name-link">fit</a><wbr>(<a href="Vector.html" title="class in org.apache.sis.math">Vector</a>&nbsp;x,
<a href="Vector.html" title="class in org.apache.sis.math">Vector</a>&nbsp;y)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Given a set of data points <var>x</var>[0 … <var>n</var>-1], <var>y</var>[0 … <var>n</var>-1],
fits them to a straight line <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a
least-squares senses.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#hashCode()" class="member-name-link">hash­Code</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a hash code value for this line.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setEquation(double,double)" class="member-name-link">set­Equation</a><wbr>(double&nbsp;slope,
double&nbsp;y0)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets this line to the specified slope and offset.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setEquation(java.lang.Number,java.lang.Number)" class="member-name-link">set­Equation</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>&nbsp;slope,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>&nbsp;y0)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets this line from values of arbitrary <code>Number</code> type.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setFromPoints(double,double,double,double)" class="member-name-link">set­From­Points</a><wbr>(double&nbsp;x1,
double&nbsp;y1,
double&nbsp;x2,
double&nbsp;y2)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets a line through the specified points.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#slope()" class="member-name-link">slope</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the slope.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toString()" class="member-name-link">to­String</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a string representation of this line.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#translate(double,double)" class="member-name-link">translate</a><wbr>(double&nbsp;dx,
double&nbsp;dy)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Translates the line.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#x(double)" class="member-name-link">x</a><wbr>(double&nbsp;y)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Computes <var>x</var> = <var>f</var>⁻¹(<var>y</var>).</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#x0()" class="member-name-link">x0</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the <var>x</var> value for <var>y</var> = 0.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#y(double)" class="member-name-link">y</a><wbr>(double&nbsp;x)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Computes <var>y</var> = <var>f</var>(<var>x</var>).</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#y0()" class="member-name-link">y0</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the <var>y</var> value for <var>x</var> = 0.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-DoubleUnaryOperator">Methods inherited from interface&nbsp;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html" title="class or interface in java.util.function" class="external-link">DoubleUnaryOperator</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html#andThen(java.util.function.DoubleUnaryOperator)" title="class or interface in java.util.function" class="external-link">and­Then</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html#compose(java.util.function.DoubleUnaryOperator)" title="class or interface in java.util.function" class="external-link">compose</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>Line</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Line</span>()</div>
<div class="block">Constructs an uninitialized line. All methods will return <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double​.Na­N</code></a>.</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(double,double)">
<h3>Line</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Line</span><wbr><span class="parameters">(double&nbsp;slope,
double&nbsp;y0)</span></div>
<div class="block">Constructs a line with the specified slope and offset.
The linear equation will be <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>slope</code> - the slope.</dd>
<dd><code>y0</code> - the <var>y</var> value at <var>x</var> = 0.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#setEquation(double,double)"><code>set­Equation(double, double)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="slope()">
<h3>slope</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">slope</span>()</div>
<div class="block">Returns the slope.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the slope.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#x0()"><code>x0()</code></a></li>
<li><a href="#y0()"><code>y0()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="x0()">
<h3>x0</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">x0</span>()</div>
<div class="block">Returns the <var>x</var> value for <var>y</var> = 0.
Coordinate (<var>x₀</var>, 0) is the intersection point with the <var>x</var> axis.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the <var>x</var> value for <var>y</var> = 0.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#y0()"><code>y0()</code></a></li>
<li><a href="#slope()"><code>slope()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="x(double)">
<h3>x</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">x</span><wbr><span class="parameters">(double&nbsp;y)</span></div>
<div class="block">Computes <var>x</var> = <var>f</var>⁻¹(<var>y</var>).
If the line is horizontal, then this method returns an infinite value.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>y</code> - the <var>y</var> value where to evaluate the inverse function.</dd>
<dt>Returns:</dt>
<dd>the <var>x</var> value for the given <var>y</var> value.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#y(double)"><code>y(double)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="y0()">
<h3>y0</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">y0</span>()</div>
<div class="block">Returns the <var>y</var> value for <var>x</var> = 0.
Coordinate (0, <var>y₀</var>) is the intersection point with the <var>y</var> axis.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the <var>y</var> value for <var>x</var> = 0.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#x0()"><code>x0()</code></a></li>
<li><a href="#slope()"><code>slope()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="y(double)">
<h3>y</h3>
<div class="member-signature"><span class="modifiers">public final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">y</span><wbr><span class="parameters">(double&nbsp;x)</span></div>
<div class="block">Computes <var>y</var> = <var>f</var>(<var>x</var>).
If the line is vertical, then this method returns an infinite value.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>x</code> - the <var>x</var> value where to evaluate the function.</dd>
<dt>Returns:</dt>
<dd>the <var>y</var> value for the given <var>x</var> value.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#x(double)"><code>x(double)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="applyAsDouble(double)">
<h3>applyAsDouble</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">applyAsDouble</span><wbr><span class="parameters">(double&nbsp;x)</span></div>
<div class="block">Evaluates this equation for the given value. The default implementation delegates
to <a href="#y(double)"><code>y(x)</code></a>, but subclasses may override with different formulas.
This method is provided for interoperability with libraries making use of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/package-summary.html" class="external-link"><code>java​.util​.function</code></a>.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html#applyAsDouble(double)" title="class or interface in java.util.function" class="external-link">apply­As­Double</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/DoubleUnaryOperator.html" title="class or interface in java.util.function" class="external-link">Double­Unary­Operator</a></code></dd>
<dt>Parameters:</dt>
<dd><code>x</code> - the value where to evaluate the function.</dd>
<dt>Returns:</dt>
<dd>the function value for the given operand.</dd>
<dt>Since:</dt>
<dd>1.0</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="translate(double,double)">
<h3>translate</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">translate</span><wbr><span class="parameters">(double&nbsp;dx,
double&nbsp;dy)</span></div>
<div class="block">Translates the line. The slope stay unchanged.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dx</code> - the horizontal translation.</dd>
<dd><code>dy</code> - the vertical translation.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setEquation(double,double)">
<h3>setEquation</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setEquation</span><wbr><span class="parameters">(double&nbsp;slope,
double&nbsp;y0)</span></div>
<div class="block">Sets this line to the specified slope and offset.
The linear equation will be <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>slope</code> - the slope.</dd>
<dd><code>y0</code> - the <var>y</var> value at <var>x</var> = 0.</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#setFromPoints(double,double,double,double)"><code>set­From­Points(double, double, double, double)</code></a></li>
<li><a href="#fit(double%5B%5D,double%5B%5D)"><code>fit(double[], double[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setEquation(java.lang.Number,java.lang.Number)">
<h3>setEquation</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setEquation</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>&nbsp;slope,
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>&nbsp;y0)</span></div>
<div class="block">Sets this line from values of arbitrary <code>Number</code> type. This method is invoked by algorithms that
may produce other kind of numbers (for example with different precision) than the usual <code>double</code>
primitive type. The default implementation delegates to <a href="#setEquation(double,double)"><code>set­Equation(double, double)</code></a>, but
subclasses can override this method if they want to process other kind of numbers in a special way.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>slope</code> - the slope.</dd>
<dd><code>y0</code> - the <var>y</var> value at <var>x</var> = 0.</dd>
<dt>Since:</dt>
<dd>0.8</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setFromPoints(double,double,double,double)">
<h3>setFromPoints</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setFromPoints</span><wbr><span class="parameters">(double&nbsp;x1,
double&nbsp;y1,
double&nbsp;x2,
double&nbsp;y2)</span></div>
<div class="block">Sets a line through the specified points.
The line will continue toward infinity after the points.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>x1</code> - coordinate <var>x</var> of the first point.</dd>
<dd><code>y1</code> - coordinate <var>y</var> of the first point.</dd>
<dd><code>x2</code> - coordinate <var>x</var> of the second point.</dd>
<dd><code>y2</code> - coordinate <var>y</var> of the second point.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="fit(double[],double[])">
<h3>fit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">fit</span><wbr><span class="parameters">(double[]&nbsp;x,
double[]&nbsp;y)</span></div>
<div class="block">Given a set of data points <var>x</var>[0 … <var>n</var>-1], <var>y</var>[0 … <var>n</var>-1],
fits them to a straight line <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a
least-squares senses.
This method assumes that the <var>x</var> values are precise and all uncertainty is in <var>y</var>.
<p>The default implementation delegates to <a href="#fit(org.apache.sis.math.Vector,org.apache.sis.math.Vector)"><code>fit(Vector, Vector)</code></a>.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>x</code> - vector of <var>x</var> values (independent variable).</dd>
<dd><code>y</code> - vector of <var>y</var> values (dependent variable).</dd>
<dt>Returns:</dt>
<dd>estimation of the correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if <var>x</var> and <var>y</var> do not have the same length.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="fit(org.apache.sis.math.Vector,org.apache.sis.math.Vector)">
<h3>fit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">fit</span><wbr><span class="parameters">(<a href="Vector.html" title="class in org.apache.sis.math">Vector</a>&nbsp;x,
<a href="Vector.html" title="class in org.apache.sis.math">Vector</a>&nbsp;y)</span></div>
<div class="block">Given a set of data points <var>x</var>[0 … <var>n</var>-1], <var>y</var>[0 … <var>n</var>-1],
fits them to a straight line <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a
least-squares senses.
This method assumes that the <var>x</var> values are precise and all uncertainty is in <var>y</var>.
<p>The default implementation delegates to <a href="#fit(java.lang.Iterable)"><code>fit(Iterable)</code></a>.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>x</code> - vector of <var>x</var> values (independent variable).</dd>
<dd><code>y</code> - vector of <var>y</var> values (dependent variable).</dd>
<dt>Returns:</dt>
<dd>estimation of the correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if <var>x</var> and <var>y</var> do not have the same length.</dd>
<dt>Since:</dt>
<dd>0.8</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="fit(java.lang.Iterable)">
<h3>fit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">fit</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html" title="class or interface in java.lang" class="external-link">Iterable</a>&lt;? extends <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/geometry/DirectPosition.html" title="class or interface in org.opengis.geometry" class="external-link">DirectPosition</a>&gt;&nbsp;points)</span></div>
<div class="block">Given a sequence of points, fits them to a straight line
<var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var> in a least-squares senses.
Points shall be two dimensional with coordinate values in the (<var>x</var>,<var>y</var>) order.
This method assumes that the <var>x</var> values are precise and all uncertainty is in <var>y</var>.
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double​.Na­N</code></a> coordinate values are ignored.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>points</code> - the two-dimensional points.</dd>
<dt>Returns:</dt>
<dd>estimation of the correlation coefficient. The closer this coefficient is to +1 or -1, the better the fit.</dd>
<dt>Throws:</dt>
<dd><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/geometry/MismatchedDimensionException.html" title="class or interface in org.opengis.geometry" class="external-link">Mismatched­Dimension­Exception</a></code> - if a point is not two-dimensional.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="clone()">
<h3>clone</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="Line.html" title="class in org.apache.sis.math">Line</a></span>&nbsp;<span class="element-name">clone</span>()</div>
<div class="block">Returns a clone of this line.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
<dt>Returns:</dt>
<dd>a clone of this line.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="equals(java.lang.Object)">
<h3>equals</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">equals</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;object)</span></div>
<div class="block">Compares this line with the specified object for equality.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
<dt>Parameters:</dt>
<dd><code>object</code> - the object to compare with this line for equality.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if both objects are equal.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="hashCode()">
<h3>hashCode</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">hashCode</span>()</div>
<div class="block">Returns a hash code value for this line.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hash­Code</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toString()">
<h3>toString</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">toString</span>()</div>
<div class="block">Returns a string representation of this line. This method returns the linear equation
in the form <var>y</var> = <var>slope</var><var>x</var> + <var>y₀</var>.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">to­String</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
<dt>Returns:</dt>
<dd>a string representation of this line.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>