[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtk-developers
Subject:    [vtk-developers] vtkXYPlotActor: ViewportToPlotCoordinate issue
From:       Mathieu Coursolle <mcoursolle () rogue-research ! com>
Date:       2009-03-13 15:51:27
Message-ID: EAFC938B-A97C-4DF4-ABBF-13349E9BBA01 () rogue-research ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi VTK users/developers,

I am using vtkXYPlotActor and I need to convert mouse event position  
into
plot position.

double coordinates[2] = {0.0, 0.0};
thePlot->SetViewportCoordinate(inX, inY);
thePlot->ViewportToPlotCoordinate(theRenderer);
thePlot->GetPlotCoordinate(coordinates);

I would except the previous code to work:
1) I set the viewport coordinates.
2) Convert to plot coordinates.
3) Retrieve the plot coordinates.

However, I stepped in the code and realized that  
ViewportToPlotCoordinate(...)
sets the viewportCoordinates.

Am I missing something here?

If I read the viewportCoordinates, it returns the right value:

double coordinates[2] = {0.0, 0.0};
thePlot->SetViewportCoordinate(inX, inY);
thePlot->ViewportToPlotCoordinate(theRenderer);
thePlot->GetViewportCoordinate(coordinates);

Thanks,

Mathieu
____________________
Mathieu Coursolle, M.Ing.		
Rogue Research Inc.
www.rogue-research.com








[Attachment #5 (text/html)]

<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div>Hi VTK \
users/developers,</div><div><br></div><div>I am using vtkXYPlotActor and I need to \
convert mouse event position into</div><div>plot \
position.</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; \
"><span style="color: #1046da">double</span> coordinates[2] = {0.0, 0.0};</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 12px/normal Monaco; ">thePlot->SetViewportCoordinate(inX, \
inY);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; font: normal normal normal 12px/normal Monaco; \
">thePlot->ViewportToPlotCoordinate(theRenderer);</div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
12px/normal Monaco; ">thePlot->GetPlotCoordinate(coordinates);</div></div><div><br></div><div>I \
would except the previous code to work:</div><div>1) I set the viewport \
coordinates.</div><div>2) Convert to plot coordinates.</div><div>3) Retrieve the plot \
coordinates.</div><div><br></div><div>However, I stepped in the code and realized \
that ViewportToPlotCoordinate(...)</div><div>sets the \
viewportCoordinates.</div><div><br></div><div>Am I missing something \
here?</div><div><br></div><div>If I read the viewportCoordinates, it returns the \
right value:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Monaco; \
"><span style="color: rgb(16, 70, 218); ">double</span>&nbsp;coordinates[2] = {0.0, \
0.0};</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; font: normal normal normal 12px/normal Monaco; \
">thePlot->SetViewportCoordinate(inX, inY);</div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
12px/normal Monaco; ">thePlot->ViewportToPlotCoordinate(theRenderer);</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 12px/normal Monaco; \
">thePlot->GetViewportCoordinate(coordinates);</div></div><div><br></div>Thanks,<div><br></div><div>Mathieu<br><div> \
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; \
color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; \
font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: \
normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; \
color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; \
font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: \
normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; \
color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; \
font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: \
normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "><div>____________________&nbsp;<br>Mathieu Coursolle, \
M.Ing.<span class="Apple-tab-span" style="white-space: pre; ">		</span><br>Rogue \
Research Inc. &nbsp; &nbsp; &nbsp; &nbsp;</div><div><a \
href="http://www.rogue-research.com/">www.rogue-research.com</a><br></div><div><br></div><div><br></div></div></span><br \
class="Apple-interchange-newline"></div></span><br \
class="Apple-interchange-newline"></div></span><br \
class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> \
</div><br></div></body></html>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic