# How to get the x component of a point?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 January 11, 2016, 07:53 How to get the x component of a point? #1 New Member   Chengyu Wang Join Date: Dec 2015 Posts: 7 Rep Power: 10 Hello Foamers! I'm trying to modify decompose method, for which I need to get the x component of a point. A series of points is defined like this: Code: `pointField points` There is a way to get the value of its X component and it works like this: Code: `points.component(vector::X)` What this returns is a vector(I think), but how can I get the certain component of this vector? e.g. the first component of it. I tried points.component(vector::X)[0], points.component(vector::X).value(0), points.component(vector::X).component(0). But none of them works. Does anyone has an idea? I'd be very appreciate for your answer! Best regards Gerwang

January 11, 2016, 08:18
#2
New Member

Chengyu Wang
Join Date: Dec 2015
Posts: 7
Rep Power: 10
I figured out one way to do it, and now it works, just use:
Code:
`points[0].component(vector::X)`
Quote:
 Originally Posted by Gerwang Hello Foamers! I'm trying to modify decompose method, for which I need to get the x component of a point. A series of points is defined like this: Code: `pointField points` There is a way to get the value of its X component and it works like this: Code: `points.component(vector::X)` What this returns is a vector(I think), but how can I get the certain component of this vector? e.g. the first component of it. I tried points.component(vector::X)[0], points.component(vector::X).value(0), points.component(vector::X).component(0). But none of them works. Does anyone has an idea? I'd be very appreciate for your answer! Best regards Gerwang

 Tags coordinate of points, pointfiels