haiku-website/static/legacy-docs/bebook/BPoint.html

71 lines
16 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Interface Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInterfaceKit.html" title="The Interface Kit" /><link rel="prev" href="BPictureButton.html" title="BPictureButton" /><link rel="next" href="BPolygon.html" title="BPolygon" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BPictureButton.html" title="BPictureButton"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BPolygon.html" title="BPolygon"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Interface Kit</div></div><div id="headerB">Prev: <a href="BPictureButton.html">BPictureButton</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPolygon.html">BPolygon</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint"></a>BPoint</h2></div></div></div><a id="id1011813" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/Point.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>Constructor or on the stack, typically the latter.</td></tr></tbody></table></td><td>
<a class="link overview" href="BPoint_Overview.html" title="BPoint">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BPoint.html#BPoint_DataMembers">Data Members</a></span></li><li><span class="section"><a href="BPoint.html#BPoint_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BPoint.html#BPoint_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BPoint.html#BPoint_Operators">Operators</a></span></li><li><span class="section"><a href="BPoint.html#BPoint_GlobalObjects">Global Objects</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_DataMembers"></a>Data Members</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_X"></a>float x</h4></div></div></div><p>
The coordinate value measured horizontally along the x-axis.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_Y"></a>float y</h4></div></div></div><p>
The coordinate value measured vertically along the y-axis.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_Constructor"></a>BPoint()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="modifier">inline </span><span class="methodname">BPoint</span>(<span class="methodparam"><span class="type">float </span><span class="parameter">x</span></span>,<br />              <span class="methodparam"><span class="type">float </span><span class="parameter">y</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="modifier">inline </span><span class="methodname">BPoint</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span><span class="parameter">point</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="modifier">inline </span><span class="methodname">BPoint</span>();</code>
</div><p>
Creates a new <code class="classname">BPoint</code> object that corresponds to the
point (<code class="parameter">x</code>, <code class="parameter">y</code>), or
<code class="classname">BPoint</code>
that's copied from point. If no coordinate values are assigned, the
<code class="classname">BPoint</code>'s location is indeterminate.
</p><p>
See also:
<a class="link" href="BPoint.html#BPoint_Set" title="Set()"><code class="methodname">Set()</code></a>,
the assignment operator
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_ConstrainTo"></a>ConstrainTo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">ConstrainTo</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">rect</span></span>);</code><p>
Ensures that the <code class="classname">BPoint</code> lies within <code class="parameter">rect</code>.
If it's already contained in
the rectangle, the <code class="classname">BPoint</code> is unchanged; otherwise, it's moved to the
<code class="parameter">rect</code>'s nearest edge.
</p><p>
See also:
<a class="link" href="BRect.html#BRect_Contains" title="Contains(), Intersects()"><code class="methodname">BRect::Contains()</code></a>
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_PrintToStream"></a>PrintToStream()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">PrintToStream</span>() <span class="modifier">const</span>;</code><p>
Prints the <code class="classname">BPoint</code>'s coordinates to standard output in the form:
</p><pre class="screen">
"<code class="classname">BPoint</code>(x, y)"
</pre></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_Set"></a>Set()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">inline </span><span class="void">void </span><span class="methodname">Set</span>(<span class="methodparam"><span class="type">float </span><span class="parameter">x</span></span>,<br />                <span class="methodparam"><span class="type">float </span><span class="parameter">y</span></span>);</code><p>
Sets the <code class="classname">BPoint</code>'s x and y coordinates.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_Operators"></a>Operators</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_operator_equals"></a>= (assignment)</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">inline </span><span class="type">BPoint&amp; </span><span class="methodname">operator =</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span><span class="parameter">from</span></span>);</code><p>
Copies from's coordinate data into the left-side object.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_operator_inequality"></a><a id="BPoint_operator_equality"></a>
== (equality), != (inequality)</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">operator ==</span>(<span class="methodparam"><span class="classname">BPoint</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">operator !=</span>(<span class="methodparam"><span class="classname">BPoint</span></span>) <span class="modifier">const</span>;</code><p>
<code class="methodname">==</code> returns <code class="constant">true</code> if
the two objects' point exactly coincide.
</p><p>
<code class="methodname">!=</code> returns <code class="constant">true</code> if
the two objects' points don't coincide.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_operator_addition"></a><a id="BPoint_operator_addition_assignment"></a>
+ (addition), += (addition and assignment)</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">BPoint </span><span class="methodname">operator +</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">BPoint </span><span class="methodname">operator +=</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span></span>) <span class="modifier">const</span>;</code><p>
<code class="methodname">+</code> creates and returns a new <code class="classname">BPoint</code> that adds the two operands together.
The new object's x coordinate is the sum of the operands' x values; its y
value is the sum of the operands' y values.
</p><p>
<code class="methodname">+=</code> adds the operands together and stores the result in the left operand.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_operator_subtraction"></a><a id="BPoint_operator_subtraction_assignment"></a>
- (subtraction), -= (subtraction and assignment)</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">BPoint </span><span class="methodname">operator -</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">BPoint </span><span class="methodname">operator -=</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPoint&amp; </span></span>) <span class="modifier">const</span>;</code><p>
<code class="methodname">-</code> creates and returns a new <code class="classname">BPoint</code> that subtracts the right operand from
the left. The new object's x coordinate is the difference between the
operands' x values; its y value is the difference between the operands' y
values.
</p><p>
<code class="methodname">-=</code> performs the subtraction and stores the result in the left operand.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_GlobalObjects"></a>Global Objects</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPoint_B_ORIGIN"></a>B_ORIGIN</h4></div></div></div><p>
<code class="classname">BPoint</code> object that represents (0.0, 0.0).
</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BPictureButton.html">BPictureButton</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPolygon.html">BPolygon</a> </div><div id="footerB"><div id="footerBL"><a href="BPictureButton.html" title="BPictureButton"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BPolygon.html" title="BPolygon"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>